]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fixed a floating crash on first change of "Create new part" in preferences dialog. CR29475
authormpv <mpv@opencascade.com>
Thu, 2 Jun 2022 14:07:50 +0000 (17:07 +0300)
committermpv <mpv@opencascade.com>
Thu, 2 Jun 2022 14:07:50 +0000 (17:07 +0300)
src/ModuleBase/ModuleBase_Preferences.cpp
src/SHAPERGUI/SHAPERGUI.cpp
src/SHAPERGUI/resources/LightApp.xml.in
src/XGUI/SHAPER.xml

index 0f4d2f121ba4ed7e3e8e728fa45b40aac186c392..004965fd41b641022c1f7a16b48f95772a1a99e9 100644 (file)
@@ -177,10 +177,6 @@ void ModuleBase_Preferences::createGeneralTab(ModuleBase_IPrefMgr* thePref, int
 
   int actId = thePref->addPreference(QObject::tr("Create new part"), group, SUIT_PreferenceMgr::Bool,
                                      ModuleBase_Preferences::GENERAL_SECTION, "create_init_part");
-  if (!resourceMgr()->hasValue(ModuleBase_Preferences::GENERAL_SECTION, "create_init_part"))
-  { // set default value: true
-    resourceMgr()->setValue(ModuleBase_Preferences::GENERAL_SECTION, "create_init_part", true);
-  }
 
   // Group related to running a python script
   group = thePref->addPreference(QObject::tr("Launching a python script"), generalTab,
index bcdcd5f81e1bb7e7101814a939a73f3c2f660dd3..24f02c05342d7ae41d4945ae04f71d49857bd44d 100644 (file)
@@ -947,6 +947,8 @@ void SHAPERGUI::preferencesChanged(const QString& theSection, const QString& the
   QString aVal = aResMgr->stringValue(theSection, theParam);
   Config_Prop* aProp = Config_PropManager::findProp(theSection.toStdString(),
                                                     theParam.toStdString());
+  if (!aProp)
+    return; // invalid case, the property default value must be registered in XML file
   std::string aValue = aVal.toStdString();
   if (aValue.empty()) {
     aValue = aProp->defaultValue();
index 9aa2e50061b27f141e26eb140112dc6f9a47516b..a288317694d758a8604bf99a9ad2c623fa42f9c9 100644 (file)
@@ -27,6 +27,7 @@
     <parameter name="part_activation_study" value="0"/>
     <parameter name="part_visualization_study" value="0"/>
     <parameter name="part_visualization_script" value="1"/>
+    <parameter name="create_init_part" value="true"/>
   </section>
   <section name="Sketch">
     <!-- Sketch preferences -->
index ed65fcec5c7b7b5448a2d616d08ccc736c8f5a9b..d2ae6680702804e19c1d446ba99d34a5c5e483ba 100644 (file)
@@ -9,6 +9,7 @@
     <parameter name="part_activation_study" value="0"/>
     <parameter name="part_visualization_study" value="0"/>
     <parameter name="part_visualization_script" value="1"/>
+    <parameter name="create_init_part" value="true"/>
   </section>
   <section name="Sketch">
     <!-- Sketch preferences -->