Browse Source

when destroying a gui object, properly destroy it's child gui objects

Redmond Urbino 19 years ago
parent
commit
60b62dd82f
1 changed files with 9 additions and 1 deletions
  1. 9 1
      direct/src/gui/DirectGuiBase.py

+ 9 - 1
direct/src/gui/DirectGuiBase.py

@@ -1031,7 +1031,15 @@ class DirectGuiWidget(DirectGuiBase, NodePath):
             # Destroy children
             for child in self.getChildrenAsList():
                 childGui = self.guiDict.get(child.getName())
-                if childGui: childGui.destroy()
+                if childGui:
+                    childGui.destroy()
+                else:
+                    # RAU since we added the class to the name, try
+                    # it with the original name
+                    parts = child.getName().split('-')
+                    simpleChildGui = self.guiDict.get(parts[-1])
+                    if simpleChildGui:
+                        simpleChildGui.destroy()
                 # messenger.send(DESTROY + child.getName())
             del self.guiDict[self.guiId]
             del self.frameStyle