]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix crashes in unit tests (produced by stack of transactions)
authorazv <azv@opencascade.com>
Mon, 24 Jun 2019 14:10:05 +0000 (17:10 +0300)
committerazv <azv@opencascade.com>
Mon, 24 Jun 2019 14:10:05 +0000 (17:10 +0300)
src/FeaturesPlugin/Test/TestPlacement_Edge_Edge.py
src/FeaturesPlugin/Test/TestPlacement_Edge_Vertex.py
src/FeaturesPlugin/Test/TestPlacement_Face_Edge.py
src/FeaturesPlugin/Test/TestPlacement_Face_Face.py
src/FeaturesPlugin/Test/TestPlacement_Face_Vertex.py
src/Model/Model_Session.cpp

index e0c262dd02939edfc9f09bec14a992120a79f01d..317c16f841e41a37820d7eb437a2b74f64ef1296 100644 (file)
@@ -133,7 +133,6 @@ aSession.finishOperation()
 assert (len(aPlacementFt.results()) > 0)
 aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult())
 assert (aPlacementResult is not None)
-aSession.finishOperation()
 
 from salome.shaper import model
 assert(model.checkPythonDump())
index d5315e6b7a6bcbe95402732e2dccd3ca70be104f..197e344d348e6d75484f450fcc84aa74f0cc45f6 100644 (file)
@@ -133,7 +133,6 @@ aSession.finishOperation()
 assert (len(aPlacementFt.results()) > 0)
 aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult())
 assert (aPlacementResult is not None)
-aSession.finishOperation()
 
 from salome.shaper import model
 assert(model.checkPythonDump())
index 5cdaeff553f8445c1aab6b0133fdbdc784572fe9..85e121d3a4281e23886a50c4a37d5d0299e9bdf9 100644 (file)
@@ -133,7 +133,6 @@ aSession.finishOperation()
 assert (len(aPlacementFt.results()) > 0)
 aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult())
 assert (aPlacementResult is not None)
-aSession.finishOperation()
 
 from salome.shaper import model
 assert(model.checkPythonDump())
index edcfc7bcec46b2ba02f29e5ecbd1aa6d92ca7ed3..8b34dc5bf865924c69a3238e5b776f3c5fc153e9 100644 (file)
@@ -133,7 +133,6 @@ aSession.finishOperation()
 assert (len(aPlacementFt.results()) > 0)
 aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult())
 assert (aPlacementResult is not None)
-aSession.finishOperation()
 
 from salome.shaper import model
 assert(model.checkPythonDump())
index e7ee2f83569d79b317245e0f0a7b6584a50520dc..31d3ed87a77f1fbf90f99f31271f680c9830b9b5 100644 (file)
@@ -133,7 +133,6 @@ aSession.finishOperation()
 assert (len(aPlacementFt.results()) > 0)
 aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult())
 assert (aPlacementResult is not None)
-aSession.finishOperation()
 
 from salome.shaper import model
 assert(model.checkPythonDump())
index afdf7e4a5773f37da44c341b869d1ad2b54344b6..aed8b486a860344541266fa8cb085bff37487bf0 100644 (file)
@@ -98,12 +98,14 @@ void Model_Session::finishOperation()
 {
   setCheckTransactions(false);
   ROOT_DOC->finishOperation();
-  while(myOperationAttachedToNext.back()) {
-    // with nested, the first transaction can not be attached
-    ROOT_DOC->finishOperation();
+  if (!myOperationAttachedToNext.empty()) {
+    while (myOperationAttachedToNext.back()) {
+      // with nested, the first transaction can not be attached
+      ROOT_DOC->finishOperation();
+      myOperationAttachedToNext.pop_back();
+    }
     myOperationAttachedToNext.pop_back();
   }
-  myOperationAttachedToNext.pop_back();
   setCheckTransactions(true);
 }
 
@@ -111,12 +113,14 @@ void Model_Session::abortOperation()
 {
   setCheckTransactions(false);
   ROOT_DOC->abortOperation();
-  while(myOperationAttachedToNext.back()) {
-    // with nested, the first transaction can not be attached
-    ROOT_DOC->abortOperation();
+  if (!myOperationAttachedToNext.empty()) {
+    while (myOperationAttachedToNext.back()) {
+      // with nested, the first transaction can not be attached
+      ROOT_DOC->abortOperation();
+      myOperationAttachedToNext.pop_back();
+    }
     myOperationAttachedToNext.pop_back();
   }
-  myOperationAttachedToNext.pop_back();
   setCheckTransactions(true);
   // here the update mechanism may work after abort, so, suppress the warnings about
   // modifications outside of the transactions