Skip to content

Commit

Permalink
Properly deal with deleted objects when cleaning up the extension vis…
Browse files Browse the repository at this point in the history
…ualisation.
  • Loading branch information
mlampert committed Jun 30, 2019
1 parent aa15a6c commit 6893960
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Mod/Path/PathScripts/PathPocketShapeGui.py
Expand Up @@ -178,7 +178,16 @@ def initPage(self, obj):
Page = self

def cleanupPage(self, obj):
self.obj.ViewObject.RootNode.removeChild(self.switch)
# If the object was already destroyed we can't access obj.Name.
# This is the case if this was a new op and the user hit Cancel.
# Unfortunately there's no direct way to determine the object's
# livelihood without causing an error so we look for the object
# in the document and clean up if it still exists.
for o in self.obj.Document.getObjectsByLabel(self.obj.Label):
if o == obj:
self.obj.ViewObject.RootNode.removeChild(self.switch)
return
PathLog.debug("%s already destroyed - no cleanup required" % (obj.Label))

def getForm(self):
return FreeCADGui.PySideUic.loadUi(":/panels/PageOpPocketExtEdit.ui")
Expand Down

0 comments on commit 6893960

Please sign in to comment.