From 13699e9eac8a691d5e47e5f9e2f5d46c118e3397 Mon Sep 17 00:00:00 2001 From: apo Date: Wed, 17 Jan 2007 13:57:59 +0000 Subject: [PATCH] To fix crash on "Rename" & "Cancel" --- src/VISUGUI/VisuGUI.cxx | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index c3783b2a..a579baba 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -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(aViewManager)){ - if(SPlot2d_Viewer* aViewer = dynamic_cast(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(aViewManager)){ + if(SPlot2d_Viewer* aViewer = dynamic_cast(aManager->getViewModel())) + aViewer->renameAll( anIO, Name.latin1() ); + } } - } - UpdateObjBrowser(this, false); + UpdateObjBrowser(this, false); + } QApplication::restoreOverrideCursor(); } -- 2.39.2