AttachEngine: fix crash when referenced objects get deleted

... by verifying if the pointers equal to objects contained in all open
documents. Not terribly good, but I can't think of a situation where
doing this search might cause trouble.
This commit is contained in:
DeepSOIC
2016-05-14 02:14:51 +03:00
parent 2d8a7614c5
commit 71f70eb855
3 changed files with 28 additions and 0 deletions

View File

@@ -111,6 +111,7 @@ Py::Object AttachEnginePy::getReferences(void) const
{
try {
AttachEngine &attacher = *(this->getAttachEnginePtr());
AttachEngine::verifyReferencesAreSafe(attacher.references);
return Py::Object(attacher.references.getPyObject(),true);
} ATTACHERPY_STDCATCH_ATTR;
}
@@ -523,6 +524,7 @@ PyObject* AttachEnginePy::writeParametersToFeature(PyObject* args)
}
Part::AttachableObject* feat = static_cast<Part::AttachableObject*>(dobj);
const AttachEngine &attacher = *(this->getAttachEnginePtr());
AttachEngine::verifyReferencesAreSafe(attacher.references);
feat->Support.Paste(attacher.references);
feat->MapMode.setValue(attacher.mapMode);
feat->MapReversed.setValue(attacher.mapReverse);