Salome HOME
Fix for the bug IPAL22091: Crash by calling context menu on the SMESH presentation
authorana <ana@opencascade.com>
Thu, 10 Feb 2011 08:48:33 +0000 (08:48 +0000)
committerana <ana@opencascade.com>
Thu, 10 Feb 2011 08:48:33 +0000 (08:48 +0000)
src/SMESHGUI/SMESHGUI.cxx

index fcc4ba4bb8009c2c97d2f90247a64a6b029e8936..28137a3541c9f92ed04dab95ab3a0a4e6d6f6bea 100644 (file)
 
     SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
 
-    ViewManagerList aViewMenegers = anApp->viewManagers();
-    ViewManagerList::const_iterator it = aViewMenegers.begin();
-    for( ; it != aViewMenegers.end(); it++) {
-      
-      SUIT_ViewManager* vm = *it;
-      int nbSf = vm ? vm->getViewsCount() : 0;
-
       SALOME_ListIteratorOfListIO It(selected);
       
       aStudyBuilder->NewCommand();  // There is a transaction
             std::string anEntry = SO->GetID();
             
             /** Erase graphical object **/
-            if(SO->FindAttribute(anAttr, "AttributeIOR") && vm ){
-              QVector<SUIT_ViewWindow*> aViews = vm->getViews();
-              for(int i = 0; i < nbSf; i++){
-                SUIT_ViewWindow *sf = aViews[i];
-                if(SMESH_Actor* anActor = SMESH::FindActorByEntry(sf,anEntry.c_str())){
-                  SMESH::RemoveActor(sf,anActor);
+         if(SO->FindAttribute(anAttr, "AttributeIOR")){
+           ViewManagerList aViewMenegers = anApp->viewManagers();
+           ViewManagerList::const_iterator it = aViewMenegers.begin();
+           for( ; it != aViewMenegers.end(); it++) {         
+             SUIT_ViewManager* vm = *it;
+             int nbSf = vm ? vm->getViewsCount() : 0;
+             if(vm) {
+                QVector<SUIT_ViewWindow*> aViews = vm->getViews();
+                for(int i = 0; i < nbSf; i++){
+                  SUIT_ViewWindow *sf = aViews[i];
+                  if(SMESH_Actor* anActor = SMESH::FindActorByEntry(sf,anEntry.c_str())){
+                    SMESH::RemoveActor(sf,anActor);
+                  }
                 }
               }
-            }
-            
+           }
+         }
             /** Remove an object from data structures **/
             SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( SMESH::SObjectToObject( SO ));
             SMESH::SMESH_subMesh_var   aSubMesh = SMESH::SMESH_subMesh::_narrow( SMESH::SObjectToObject( SO ));
           } /* listSO back loop */
         } /* IObject->hasEntry() */
       } /* more/next */
-    } /* aViewMenegers list loop */
     
     aStudyBuilder->CommitCommand();