Salome HOME
Fix for bug 10438: Crash during Explode on Blocks operation (Global selection on...
[modules/gui.git] / src / CAM / CAM_Application.cxx
index d20e26ad7e16cdb4355b893898913c53cd1ea96d..171a2cb1ba6b6cd45c33b4f11c5c755d2a44a1f4 100755 (executable)
@@ -290,20 +290,7 @@ bool CAM_Application::activateModule( CAM_Module* mod )
 
   if ( myModule ){
     // Connect the module to the active study
-    CAM_Study* camStudy = dynamic_cast<CAM_Study*>( activeStudy() );
-    if ( camStudy ){
-      CAM_DataModel* prev = 0;
-      for ( ModuleListIterator it( myModules ); it.current(); ++it ) {
-       CAM_DataModel* dm = it.current()->dataModel();
-       if ( it.current() == myModule && !camStudy->containsDataModel( dm ) ){
-         if ( prev )
-           camStudy->insertDataModel( it.current()->dataModel(), prev );
-         else
-           camStudy->insertDataModel( it.current()->dataModel(), 0 );
-       }
-       prev = dm;
-      }
-    }
+    myModule->connectToStudy( dynamic_cast<CAM_Study*>( activeStudy() ) );
     if ( !myModule->activateModule( activeStudy() ) )
     {
       myModule->setMenuShown( false );
@@ -482,11 +469,11 @@ void CAM_Application::createEmptyStudy()
 
   STD_Application::createEmptyStudy();
 
-  //SUIT_Study* newStudy = activeStudy();
-  //if ( study != newStudy ) 
-  //{
-  //  CAM_Study* camStudy = dynamic_cast<CAM_Study*>( newStudy );
-  //  for ( ModuleListIterator it( myModules ); it.current(); ++it )
-  //    camStudy->insertDataModel( it.current()->dataModel() );
-  //}
+  SUIT_Study* newStudy = activeStudy();
+  if ( study != newStudy ) 
+  {
+    CAM_Study* camStudy = dynamic_cast<CAM_Study*>( newStudy );
+    for ( ModuleListIterator it( myModules ); it.current(); ++it )
+      camStudy->insertDataModel( it.current()->dataModel() );
+  }
 }