From: rnv Date: Thu, 19 May 2011 12:42:55 +0000 (+0000) Subject: Fix for the bugs: X-Git-Tag: V6_3_0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=32a0b698fabe3691bdff418695806f4c371d7b0a;p=modules%2Fgui.git Fix for the bugs: 1) Bug IPAL22450 TC6.3.0: sigsegv loop deleting the GUI state 2) Bug IPAL22448 TC6.3.0: GUI state doesn't appear in the object browser 3) Bug IPAL22451 TC6.3.0: incorrect deletion of GUI states --- diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index be0d219fe..59ee60a7c 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -895,8 +895,7 @@ void SalomeApp_Application::onSaveGUIState() if ( study ) { SalomeApp_VisualState( this ).storeState(); updateSavePointDataObjects( study ); - // temporary commented - //objectBrowser()->updateTree( study->root() ); + updateObjectBrowser(); } updateActions(); } @@ -1534,10 +1533,11 @@ void SalomeApp_Application::onStudyOpened( SUIT_Study* study ) /*! updateSavePointDataObjects: syncronize data objects that correspond to save points (gui states)*/ void SalomeApp_Application::updateSavePointDataObjects( SalomeApp_Study* study ) { - // temporary commented - //OB_Browser* ob = objectBrowser(); - if ( !study /*|| !ob */) // temporary commented + SUIT_DataBrowser* ob = objectBrowser(); + LightApp_SelectionMgr* selMgr = selectionMgr(); + + if ( !study || !ob || !selMgr ) return; // find GUI states root object @@ -1554,7 +1554,16 @@ void SalomeApp_Application::updateSavePointDataObjects( SalomeApp_Study* study ) std::vector savePoints = study->getSavePoints(); // case 1: no more save points but they existed in study's tree if ( savePoints.empty() && guiRootObj ) { + //rnv : to fix bug "IPAL22450 TC6.3.0: sigsegv loop deleting the GUI state" + // : set auto update to true for removing SalomeApp_SavePointRootObject from the SUIT_TreeModel + const bool isAutoUpdate = ob->autoUpdate(); + selMgr->clearSelected(); + ob->setAutoUpdate(true); + DataObjectList ch = guiRootObj->children(); + for( int i = 0; i < ch.size(); i++ ) + delete ch[i]; delete guiRootObj; + ob->setAutoUpdate(isAutoUpdate); return; } // case 2: no more save points but root does not exist either @@ -1591,8 +1600,16 @@ void SalomeApp_Application::updateSavePointDataObjects( SalomeApp_Study* study ) mapDO.remove( savePoints[i] ); // delete DataObjects that are still in the map -- their IDs were not found in data model - for ( QMap::Iterator it = mapDO.begin(); it != mapDO.end(); ++it ) - delete it.value(); + if( mapDO.size() > 0) { + //rnv : to fix bug "IPAL22450 TC6.3.0: sigsegv loop deleting the GUI state" + // : set auto update to true for removing SalomeApp_SavePointObject from the SUIT_TreeModel + selMgr->clearSelected(); + const bool isAutoUpdate = ob->autoUpdate(); + ob->setAutoUpdate(true); + for ( QMap::Iterator it = mapDO.begin(); it != mapDO.end(); ++it ) + delete it.value(); + ob->setAutoUpdate(isAutoUpdate); + } } /*! Check data object */