From: mkr Date: Wed, 13 Jul 2005 10:00:43 +0000 (+0000) Subject: Modifications in SalomeApp_DataModel::BuildTree(...) function : X-Git-Tag: V3_0_1~52 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9a1c1c0754258f14a4158e9a004ff15262a1e716;p=modules%2Fgui.git Modifications in SalomeApp_DataModel::BuildTree(...) function : don't skip during update those modules, which is already published in object browser, but not yet loaded. --- diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index 1db79fa56..3f1e503ae 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -541,7 +541,7 @@ void SalomeApp_Application::onLoadDoc() SUIT_Application* aApp = 0; for (unsigned int ind = 0; ind < List.size(); ind++) { - studyname = List[ind]; + studyname = List[ind].c_str(); //Add to list only unloaded studies bool isAlreadyOpen = false; for ( QPtrListIterator it( aAppList ); it.current() && !isAlreadyOpen; ++it ) @@ -1688,7 +1688,7 @@ void SalomeApp_Application::updateObjectBrowser( const bool updateModels ) if ( aComponent->ComponentDataType() == "Interface Applicative" ) continue; // skip the magic "Interface Applicative" component - + SalomeApp_DataModel::BuildTree( aComponent, study->root(), study, /*skipExisitng=*/true ); } } diff --git a/src/SalomeApp/SalomeApp_DataModel.cxx b/src/SalomeApp/SalomeApp_DataModel.cxx index b9dd382e5..1d771e2c6 100644 --- a/src/SalomeApp/SalomeApp_DataModel.cxx +++ b/src/SalomeApp/SalomeApp_DataModel.cxx @@ -16,6 +16,7 @@ #include #include +#include #include "SALOMEDS_Tool.hxx" @@ -46,9 +47,25 @@ SUIT_DataObject* SalomeApp_DataModel::BuildTree( const _PTR(SObject)& obj, { QString aSName( aSComp->GetName().c_str() ); DataObjectList allComponents = parent->children( /*recursive=*/false ); - for ( DataObjectListIterator it( allComponents ); it.current(); ++it ) - if ( it.current()->name() == aSName ) - return it.current(); + for ( DataObjectListIterator it( allComponents ); it.current(); ++it ) { + SUIT_DataObject* componentObj = it.current(); + if ( componentObj->name() == aSName ) { + //mkr : modifications for update already published in + //object browser, but not loaded yet component + //get names list of loaded modules + QStringList aLoadedModNames; + CAM_Application* anApp = dynamic_cast( SUIT_Session::session()->activeApplication() ); + if ( anApp ) anApp->modules( aLoadedModNames, /*loaded*/true ); + if ( !aLoadedModNames.isEmpty() && aLoadedModNames.contains( aSName ) == 0 ) { + // delete DataObject and re-create it and all its sub-objects + delete componentObj; + // don't do anything here, because iterator may be corrupted (deleted object inside it) + break; + } + else + return componentObj; + } + } } aDataObj = aSComp ? new SalomeApp_ModuleObject( aSComp, parent ) :