Skip to content

Commit

Permalink
TreeView: fix potential crash on deleting object
Browse files Browse the repository at this point in the history
  • Loading branch information
realthunder committed Aug 8, 2019
1 parent 00dbdb1 commit 0d53011
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Gui/Tree.cpp
Expand Up @@ -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.
Expand Down

0 comments on commit 0d53011

Please sign in to comment.