Salome HOME
Fix for bug 10438: Crash during Explode on Blocks operation (Global selection on...
[modules/gui.git] / src / CAM / CAM_Application.cxx
index 4f276dfa8ea1cbc5545d22de1ea07d47b28ae19a..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 );