]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To fix crash on "Rename" & "Cancel"
authorapo <apo@opencascade.com>
Wed, 17 Jan 2007 13:57:59 +0000 (13:57 +0000)
committerapo <apo@opencascade.com>
Wed, 17 Jan 2007 13:57:59 +0000 (13:57 +0000)
src/VISUGUI/VisuGUI.cxx

index c3783b2a9e55d63e1b97c471a2203a9957458ab2..a579baba7498dbfd611a129e2568d8ff2fc32e37 100644 (file)
@@ -1518,22 +1518,24 @@ VisuGUI
       }
     }
 
-    // rename the study object
-    Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
-    aName->SetValue(Name.latin1()); // rename the SObject
-    anIO->setName(Name.latin1()); // rename the InteractiveObject
+    if (!Name.isEmpty()) {
+      // rename the study object
+      Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
+      aName->SetValue(Name.latin1()); // rename the SObject
+      anIO->setName(Name.latin1()); // rename the InteractiveObject
       
-    ViewManagerList aViewManagerList;
-    getApp()->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList);
-    SUIT_ViewManager* aViewManager = aViewManagerList.first();
-    for(; aViewManager; aViewManager = aViewManagerList.next()){
-      if(Plot2d_ViewManager* aManager = dynamic_cast<Plot2d_ViewManager*>(aViewManager)){
-       if(SPlot2d_Viewer* aViewer = dynamic_cast<SPlot2d_Viewer*>(aManager->getViewModel()))
-         aViewer->renameAll( anIO, Name.latin1() );
+      ViewManagerList aViewManagerList;
+      getApp()->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList);
+      SUIT_ViewManager* aViewManager = aViewManagerList.first();
+      for(; aViewManager; aViewManager = aViewManagerList.next()){
+       if(Plot2d_ViewManager* aManager = dynamic_cast<Plot2d_ViewManager*>(aViewManager)){
+         if(SPlot2d_Viewer* aViewer = dynamic_cast<SPlot2d_Viewer*>(aManager->getViewModel()))
+           aViewer->renameAll( anIO, Name.latin1() );
+       }
       }
-    }
 
-    UpdateObjBrowser(this, false);
+      UpdateObjBrowser(this, false);
+    }
 
     QApplication::restoreOverrideCursor();
   }