From: mpv Date: Thu, 2 Jun 2022 14:07:50 +0000 (+0300) Subject: Fixed a floating crash on first change of "Create new part" in preferences dialog. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FCR29475;p=modules%2Fshaper.git Fixed a floating crash on first change of "Create new part" in preferences dialog. --- diff --git a/src/ModuleBase/ModuleBase_Preferences.cpp b/src/ModuleBase/ModuleBase_Preferences.cpp index 0f4d2f121..004965fd4 100644 --- a/src/ModuleBase/ModuleBase_Preferences.cpp +++ b/src/ModuleBase/ModuleBase_Preferences.cpp @@ -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, diff --git a/src/SHAPERGUI/SHAPERGUI.cpp b/src/SHAPERGUI/SHAPERGUI.cpp index bcdcd5f81..24f02c053 100644 --- a/src/SHAPERGUI/SHAPERGUI.cpp +++ b/src/SHAPERGUI/SHAPERGUI.cpp @@ -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(); diff --git a/src/SHAPERGUI/resources/LightApp.xml.in b/src/SHAPERGUI/resources/LightApp.xml.in index 9aa2e5006..a28831769 100644 --- a/src/SHAPERGUI/resources/LightApp.xml.in +++ b/src/SHAPERGUI/resources/LightApp.xml.in @@ -27,6 +27,7 @@ +
diff --git a/src/XGUI/SHAPER.xml b/src/XGUI/SHAPER.xml index ed65fcec5..d2ae66807 100644 --- a/src/XGUI/SHAPER.xml +++ b/src/XGUI/SHAPER.xml @@ -9,6 +9,7 @@ +