]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
bos #26805: regressions in tests
authorazv <azv@opencascade.com>
Thu, 16 Dec 2021 21:43:45 +0000 (00:43 +0300)
committerazv <azv@opencascade.com>
Thu, 16 Dec 2021 21:43:45 +0000 (00:43 +0300)
Eliminate SIGSEGV

src/ModelHighAPI/CMakeLists.txt
src/ModelHighAPI/ModelHighAPI_Services.cpp
src/ModuleBase/ModuleBase_Tools.cpp

index 2d7a4917f409303906b8799b958bb677e1280eaf..07adac9db8d19c84f9c7306795022b79a9b61202 100644 (file)
@@ -58,6 +58,7 @@ SET(PROJECT_LIBRARIES
   Locale
   ModelAPI
   ModelGeomAlgo
+  ModuleBase
 )
 
 ADD_DEFINITIONS(-DMODELHIGHAPI_EXPORTS -DWNT)
@@ -87,6 +88,7 @@ INCLUDE_DIRECTORIES(
   ${PROJECT_SOURCE_DIR}/src/Locale
   ${PROJECT_SOURCE_DIR}/src/ModelAPI
   ${PROJECT_SOURCE_DIR}/src/ModelGeomAlgo
+  ${PROJECT_SOURCE_DIR}/src/ModuleBase
   ${PROJECT_SOURCE_DIR}/src/PartSetPlugin
   ${OpenCASCADE_INCLUDE_DIR}
 )
index 09dea983c9743077e5e0a2631f7588b8d54b8e49..763798c8b72bb35dcdc2f8b60b64ba5f24112ece 100644 (file)
@@ -26,6 +26,8 @@
 #include <ModelAPI_ResultConstruction.h>
 #include <ModelAPI_Events.h>
 
+#include <ModuleBase_Tools.h>
+
 #include <cmath>
 #include <sstream>
 
@@ -106,8 +108,9 @@ void begin()
     aNbTransactions = aNbUndo;
     ++aTransactionID;
   }
+  static std::string anOperationPrefix(ModuleBase_Tools::translate("", "Operation").toStdString());
   std::ostringstream aTransactionName;
-  aTransactionName << "Operation_" << aTransactionID;
+  aTransactionName << anOperationPrefix << "_" << aTransactionID;
   ModelAPI_Session::get()->startOperation(aTransactionName.str());
 }
 
index 1b5bfc9a30f6b00541daaff55073eff1d0cce123..15b389749ff588f6b9326a0e539b46308c99203a 100644 (file)
@@ -135,8 +135,13 @@ namespace ModuleBase_Tools {
 #if HAVE_SALOME
         // If the python script is being loaded now, the preferences should be used
         // to display the required object
-        SUIT_Application * app = SUIT_Session::session()->activeApplication();
-        QVariant aVar = app->property("IsLoadedScript");
+        SUIT_Session* aSession = SUIT_Session::session();
+        if (!aSession)
+          return;
+        SUIT_Application * anApp = aSession->activeApplication();
+        if (!anApp)
+          return;
+        QVariant aVar = anApp->property("IsLoadedScript");
         if (!aVar.isNull() && aVar.toBool()) {
           DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
           int aSize = aRootDoc->size(ModelAPI_ResultPart::group());