From: san Date: Wed, 28 Mar 2012 17:38:09 +0000 (+0000) Subject: Clear all TreeItem instances in SUIT_TreeModel::setRoot() when autoDeleteTree ==... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=282389f0b14ca4f8ce01fad3f1f6eec6ce2fb760;p=modules%2Fgui.git Clear all TreeItem instances in SUIT_TreeModel::setRoot() when autoDeleteTree == true to avoid crashes on model reset resulted from incorrect value returned by rowCount() --- diff --git a/src/SUIT/SUIT_TreeModel.cxx b/src/SUIT/SUIT_TreeModel.cxx index a6ff0c455..8893581a2 100755 --- a/src/SUIT/SUIT_TreeModel.cxx +++ b/src/SUIT/SUIT_TreeModel.cxx @@ -775,6 +775,12 @@ void SUIT_TreeModel::setRoot( SUIT_DataObject* r ) SUIT_DataObject::disconnect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ), this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) ); delete myRoot; + + if ( myRootItem ) { + QList items = myRootItem->children(); + for ( QList::iterator anIt = items.begin(); anIt != items.end(); anIt++ ) + delete *anIt; + } } myRoot = r;