if ( theRoot )
curObj = storeState( selObjs, openObjs, selKeys, openKeys, curKey );
+ removeConnections( myRoot );
if ( myRoot != theRoot && isAutoDeleteObjects() )
delete myRoot;
void OB_Browser::replaceTree( SUIT_DataObject* src, SUIT_DataObject* trg )
{
- if ( !src || !trg || src->root() != getRootObject() )
+ if ( !src || !trg || src == trg || src->root() != getRootObject() )
return;
DataObjectKey curKey;
src->setParent( 0 );
- if ( src != trg && isAutoDeleteObjects() )
+ removeConnections( src );
+ if ( isAutoDeleteObjects() )
delete src;
if ( parent && pos != -1 )
return;
SUIT_DataObject* obj = dataObject( item );
+ obj->disconnect( this, SLOT( onDestroyed( SUIT_DataObject* ) ) );
myItems.remove( obj );
QListViewItem* i = item->firstChild();
it.current()->connect( this, SLOT( onDestroyed( SUIT_DataObject* ) ) );
}
+void OB_Browser::removeConnections( SUIT_DataObject* obj )
+{
+ if ( !obj )
+ return;
+
+ DataObjectList childList;
+ obj->children( childList, true );
+
+ childList.prepend( obj );
+
+ for ( DataObjectListIterator it( childList ); it.current(); ++it )
+ it.current()->disconnect( this, SLOT( onDestroyed( SUIT_DataObject* ) ) );
+}
+
SUIT_DataObject* OB_Browser::storeState( DataObjectMap& selObjs, DataObjectMap& openObjs,
DataObjectKeyMap& selKeys, DataObjectKeyMap& openKeys,
DataObjectKey& curKey ) const
QListViewItem* item = listViewItem( obj );
+ obj->disconnect( this, SLOT( onDestroyed( SUIT_DataObject* ) ) );
myItems.remove( obj );
if ( obj == myRoot )
void openBranch( QListViewItem*, const int );
void removeReferences( QListViewItem* );
+ void removeConnections( SUIT_DataObject* );
void createConnections( SUIT_DataObject* );
void removeObject( SUIT_DataObject*, const bool = true );