diff --git a/src/App/Document.cpp b/src/App/Document.cpp index 3fa9a00395..47ec5d9ab2 100644 --- a/src/App/Document.cpp +++ b/src/App/Document.cpp @@ -1170,7 +1170,7 @@ void Document::_checkTransaction(DocumentObject* pcDelObj, const Property *What, return; } } - if(!pcDelObj) + if(!pcDelObj) return; // When the object is going to be deleted we have to check if it has already been added to // the undo transactions @@ -1647,6 +1647,7 @@ Document::~Document() for (auto it = d->objectMap.begin(); it != d->objectMap.end(); ++it) { it->second->setStatus(ObjectStatus::Destroy, true); delete(it->second); + it->second = nullptr; } // Remark: The API of Py::Object has been changed to set whether the wrapper owns the passed