diff --git a/src/Mod/Path/PathScripts/PathPocketShapeGui.py b/src/Mod/Path/PathScripts/PathPocketShapeGui.py index 21fa3a0a13..739808cad5 100644 --- a/src/Mod/Path/PathScripts/PathPocketShapeGui.py +++ b/src/Mod/Path/PathScripts/PathPocketShapeGui.py @@ -173,16 +173,8 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage): self.blockUpdateData = False # pylint: disable=attribute-defined-outside-init def cleanupPage(self, obj): - # 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. try: - for o in self.obj.Document.getObjectsByLabel(self.obj.Label): - if o == obj: - self.obj.ViewObject.RootNode.removeChild(self.switch) - return + self.obj.ViewObject.RootNode.removeChild(self.switch) except ReferenceError: PathLog.debug("obj already destroyed - no cleanup required")