Salome HOME
do not clear a command creating a removed group if the command does
[modules/smesh.git] / src / SMESH_I / SMESH_2smeshpy.cxx
index 9a1f356fe93fcdc4f6d2b99d56eb14cab64b9a2f..dfacfd77c12ef2534e736e632807708aa6b1840f 100644 (file)
@@ -3700,6 +3700,8 @@ _pyGroup::_pyGroup(const Handle(_pyCommand)& theCreationCmd, const _pyID & id)
   if ( !id.IsEmpty() )
     setID( id );
 
+  myCanClearCreationCmd = true;
+
   const _AString& method = theCreationCmd->GetMethod();
   if ( method == "CreateGroup" ) // CreateGroup() --> CreateEmptyGroup()
   {
@@ -3742,6 +3744,12 @@ _pyGroup::_pyGroup(const Handle(_pyCommand)& theCreationCmd, const _pyID & id)
     }
     myFilter = filter;
   }
+  else
+  {
+    // theCreationCmd does something else apart from creation of this group
+    // and thus it can't be cleared if this group is removed
+    myCanClearCreationCmd = false;
+  }
 }
 
 //================================================================================
@@ -3829,9 +3837,9 @@ void _pyGroup::Process( const Handle(_pyCommand)& theCommand)
 void _pyGroup::Flush()
 {
   if ( !theGen->IsToKeepAllCommands() &&
-       myCreationCmd && myCreationCmd->MethodStartsFrom("DoubleNode") )
+       myCreationCmd && !myCanClearCreationCmd )
   {
-    myCreationCmd.Nullify();
+    myCreationCmd.Nullify(); // this way myCreationCmd won't be cleared
   }
 }