- //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<CAM_Application*>( 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
+ // mkr : modifications for update of already published in
+ // object browser, but not loaded yet components
+ CAM_Application* anApp = dynamic_cast<CAM_Application*>
+ (SUIT_Session::session()->activeApplication());
+
+ // asv : corresponding DataObjects are DELETED before update (so they are re-built).
+ if (anApp && !anApp->module(aSName)) { // if module is not loaded, delete it's DataObject
+ // jfa: remove children before DataObject deletion
+ DataObjectList chilren = componentObj->children(/*recursive=*/true);
+ for (DataObjectListIterator itc (chilren); itc.current(); ++itc)
+ componentObj->removeChild(itc.current());
+
+ // delete DataObject itself and re-create it and all its sub-objects