Salome HOME
Avoid synchronization with geom groups when closing a study
authoreap <eap@opencascade.com>
Wed, 20 Jun 2012 12:25:16 +0000 (12:25 +0000)
committereap <eap@opencascade.com>
Wed, 20 Jun 2012 12:25:16 +0000 (12:25 +0000)
+  void setCurrentStudy( SALOMEDS::Study_ptr theStudy,
+                        bool                theStudyIsBeingClosed=false);

src/SMESH_I/SMESH_Gen_i.cxx
src/SMESH_I/SMESH_Gen_i.hxx

index 5f62002b991960c5ee6927d3635d9ef022fc9ff6..6477cd18d8b04d3c3f483ac94759a2db5ff38ab6 100644 (file)
@@ -591,6 +591,12 @@ CORBA::Boolean SMESH_Gen_i::IsEmbeddedMode()
 //=============================================================================
 
 void SMESH_Gen_i::SetCurrentStudy( SALOMEDS::Study_ptr theStudy )
+{
+  setCurrentStudy( theStudy );
+}
+
+void SMESH_Gen_i::setCurrentStudy( SALOMEDS::Study_ptr theStudy,
+                                   bool                theStudyIsBeingClosed)
 {
   int curStudyId = GetCurrentStudyID();
   myCurrentStudy = SALOMEDS::Study::_duplicate( theStudy );
@@ -601,7 +607,7 @@ void SMESH_Gen_i::SetCurrentStudy( SALOMEDS::Study_ptr theStudy )
   }
 
   // myCurrentStudy may be nil
-  if ( !CORBA::is_nil( myCurrentStudy ) ) {
+  if ( !theStudyIsBeingClosed && !CORBA::is_nil( myCurrentStudy ) ) {
     SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
     if( !myCurrentStudy->FindComponent( "GEOM" )->_is_nil() )
       aStudyBuilder->LoadWith( myCurrentStudy->FindComponent( "GEOM" ), GetGeomEngine() );
@@ -4688,7 +4694,7 @@ void SMESH_Gen_i::Close( SALOMEDS::SComponent_ptr theComponent )
   // set correct current study
   SALOMEDS::Study_var study = theComponent->GetStudy();
   if ( study->StudyId() != GetCurrentStudyID())
-    SetCurrentStudy( study );
+    setCurrentStudy( study, /*IsBeingClosed=*/true );
 
   // Clear study contexts data
   int studyId = GetCurrentStudyID();
index 04edf2f1f42f33d42609cc380bbfe921873a4c19..6de23dc5a6130c3427f36a8a8b6ebd22bdd50a9b 100644 (file)
@@ -578,6 +578,9 @@ private:
                                                 const char* theCommandNameForPython,
                                                 const char* theFileNameForPython);
 
+  void setCurrentStudy( SALOMEDS::Study_ptr theStudy,
+                        bool                theStudyIsBeingClosed=false);
+
 private:
   static GEOM::GEOM_Gen_var      myGeomGen;
   static CORBA::ORB_var          myOrb;         // ORB reference