TreeView: fix potential crash on deleting object

This commit is contained in:
Zheng, Lei
2019-08-08 22:13:04 +08:00
committed by wmayer
parent 61df79ab9f
commit e047b8764c

View File

@@ -3155,11 +3155,13 @@ void TreeWidget::_slotDeleteObject(const Gui::ViewProviderDocumentObject& view,
if(obj->getDocument() == doc)
docItem->_ParentMap.erase(obj);
bool lock = blockConnection(true);
for(auto cit=items.begin(),citNext=cit;cit!=items.end();cit=citNext) {
++citNext;
(*cit)->myOwner = 0;
delete *cit;
}
blockConnection(lock);
// Check for any child of the deleted object that is not in the tree, and put it
// under document item.