Avoid synchronization with geom groups when closing a study

+  void setCurrentStudy( SALOMEDS::Study_ptr theStudy,
+                        bool                theStudyIsBeingClosed=false);
This commit is contained in:
eap 2012-06-20 12:25:16 +00:00
parent aad57bda9f
commit 16f4d26534
2 changed files with 11 additions and 2 deletions

View File

@ -591,6 +591,12 @@ CORBA::Boolean SMESH_Gen_i::IsEmbeddedMode()
//============================================================================= //=============================================================================
void SMESH_Gen_i::SetCurrentStudy( SALOMEDS::Study_ptr theStudy ) 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(); int curStudyId = GetCurrentStudyID();
myCurrentStudy = SALOMEDS::Study::_duplicate( theStudy ); myCurrentStudy = SALOMEDS::Study::_duplicate( theStudy );
@ -601,7 +607,7 @@ void SMESH_Gen_i::SetCurrentStudy( SALOMEDS::Study_ptr theStudy )
} }
// myCurrentStudy may be nil // myCurrentStudy may be nil
if ( !CORBA::is_nil( myCurrentStudy ) ) { if ( !theStudyIsBeingClosed && !CORBA::is_nil( myCurrentStudy ) ) {
SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder(); SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
if( !myCurrentStudy->FindComponent( "GEOM" )->_is_nil() ) if( !myCurrentStudy->FindComponent( "GEOM" )->_is_nil() )
aStudyBuilder->LoadWith( myCurrentStudy->FindComponent( "GEOM" ), GetGeomEngine() ); aStudyBuilder->LoadWith( myCurrentStudy->FindComponent( "GEOM" ), GetGeomEngine() );
@ -4688,7 +4694,7 @@ void SMESH_Gen_i::Close( SALOMEDS::SComponent_ptr theComponent )
// set correct current study // set correct current study
SALOMEDS::Study_var study = theComponent->GetStudy(); SALOMEDS::Study_var study = theComponent->GetStudy();
if ( study->StudyId() != GetCurrentStudyID()) if ( study->StudyId() != GetCurrentStudyID())
SetCurrentStudy( study ); setCurrentStudy( study, /*IsBeingClosed=*/true );
// Clear study contexts data // Clear study contexts data
int studyId = GetCurrentStudyID(); int studyId = GetCurrentStudyID();

View File

@ -578,6 +578,9 @@ private:
const char* theCommandNameForPython, const char* theCommandNameForPython,
const char* theFileNameForPython); const char* theFileNameForPython);
void setCurrentStudy( SALOMEDS::Study_ptr theStudy,
bool theStudyIsBeingClosed=false);
private: private:
static GEOM::GEOM_Gen_var myGeomGen; static GEOM::GEOM_Gen_var myGeomGen;
static CORBA::ORB_var myOrb; // ORB reference static CORBA::ORB_var myOrb; // ORB reference