void ViewProviderPythonFeatureObserver::slotDeleteObject(const Gui::ViewProvider& obj) { if (!obj.isDerivedFrom(Gui::ViewProviderDocumentObject::getClassTypeId())) return; const Gui::ViewProviderDocumentObject& vp = static_cast<const Gui::ViewProviderDocumentObject&>(obj); const App::DocumentObject* docobj = vp.getObject(); App::Document* doc = docobj->getDocument(); if (!doc->getUndoMode()) return; // object will be deleted immediately, thus we don't need to store anything Base::PyGILStateLocker lock; try { App::Property* prop = vp.getPropertyByName("Proxy"); if (prop && prop->isDerivedFrom(App::PropertyPythonObject::getClassTypeId())) { proxyMap[doc][docobj] = prop->Copy(); } } catch (Py::Exception& e) { e.clear(); } }