Browse Source

check for frameStyle before deleting

Dave Schuyler 19 years ago
parent
commit
a1cb222bed
1 changed files with 16 additions and 15 deletions
  1. 16 15
      direct/src/gui/DirectGuiBase.py

+ 16 - 15
direct/src/gui/DirectGuiBase.py

@@ -996,21 +996,22 @@ class DirectGuiWidget(DirectGuiBase, NodePath):
         self.updateFrameStyle()
 
     def destroy(self):
-        # Destroy children
-        for child in self.getChildrenAsList():
-            childGui = self.guiDict.get(child.getName())
-            if childGui: childGui.destroy()
-            # messenger.send(DESTROY + child.getName())
-        del self.guiDict[self.guiId]
-        del self.frameStyle
-        # Get rid of node path
-        self.removeNode()
-        for nodePath in self.stateNodePath:
-            nodePath.removeNode()
-        del self.stateNodePath
-        del self.guiItem
-        # Call superclass destruction method (clears out hooks)
-        DirectGuiBase.destroy(self)
+        if hasattr(self, "frameStyle"):
+            # Destroy children
+            for child in self.getChildrenAsList():
+                childGui = self.guiDict.get(child.getName())
+                if childGui: childGui.destroy()
+                # messenger.send(DESTROY + child.getName())
+            del self.guiDict[self.guiId]
+            del self.frameStyle
+            # Get rid of node path
+            self.removeNode()
+            for nodePath in self.stateNodePath:
+                nodePath.removeNode()
+            del self.stateNodePath
+            del self.guiItem
+            # Call superclass destruction method (clears out hooks)
+            DirectGuiBase.destroy(self)
 
     def printConfig(self, indent = 0):
         space = ' ' * indent