From 16f4d26534ab57fe2ceddb3bedd676427b4fc80c Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 20 Jun 2012 12:25:16 +0000 Subject: [PATCH] Avoid synchronization with geom groups when closing a study + void setCurrentStudy( SALOMEDS::Study_ptr theStudy, + bool theStudyIsBeingClosed=false); --- src/SMESH_I/SMESH_Gen_i.cxx | 10 ++++++++-- src/SMESH_I/SMESH_Gen_i.hxx | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index 5f62002b9..6477cd18d 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -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(); diff --git a/src/SMESH_I/SMESH_Gen_i.hxx b/src/SMESH_I/SMESH_Gen_i.hxx index 04edf2f1f..6de23dc5a 100644 --- a/src/SMESH_I/SMESH_Gen_i.hxx +++ b/src/SMESH_I/SMESH_Gen_i.hxx @@ -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 -- 2.39.2