Skip to content

Commit ff0f8b0

Browse files
committed
Gui: [skip ci] fix crash in DocumentObjectData::updateChildren() when canceling a pending task
1 parent 7a93bcb commit ff0f8b0

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/Gui/Tree.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,17 @@ class Gui::DocumentObjectData {
322322
if (newSet.find(child) == newSet.end()) {
323323
// this means old child removed
324324
updated = true;
325-
docItem->_ParentMap[child].erase(obj);
325+
auto mapIt = docItem->_ParentMap.find(child);
326326

327-
auto childVp = docItem->getViewProvider(child);
328-
if (childVp && child->getDocument() == obj->getDocument())
329-
childVp->setShowable(docItem->isObjectShowable(child));
327+
// If 'child' is not part of the map then it has already been deleted
328+
// in _slotDeleteObject.
329+
if (mapIt != docItem->_ParentMap.end()) {
330+
docItem->_ParentMap[child].erase(obj);
331+
332+
auto childVp = docItem->getViewProvider(child);
333+
if (childVp && child->getDocument() == obj->getDocument())
334+
childVp->setShowable(docItem->isObjectShowable(child));
335+
}
330336
}
331337
}
332338
// We still need to check the order of the children

0 commit comments

Comments
 (0)