diff --git a/direct/src/gui/OnscreenPanel.py b/direct/src/gui/OnscreenPanel.py index bc40194066..b05c5fe110 100644 --- a/direct/src/gui/OnscreenPanel.py +++ b/direct/src/gui/OnscreenPanel.py @@ -29,8 +29,11 @@ def cleanupPanel(uniqueName): """ if OnscreenPanel.AllPanels.has_key(uniqueName): + # calling cleanup() will remove it out of the AllPanels dict + # This way it will get removed from the dict even it we did + # not clean it up using this interface (ie somebody called + # self.cleanup() directly OnscreenPanel.AllPanels[uniqueName].cleanup() - del OnscreenPanel.AllPanels[uniqueName] class OnscreenPanel(PandaObject.PandaObject, NodePath): @@ -189,6 +192,11 @@ class OnscreenPanel(PandaObject.PandaObject, NodePath): if not self.isEmpty(): self.removeNode() + # Remove this panel out of the AllPanels list + uniqueName = self.getUniqueName() + if OnscreenPanel.AllPanels.has_key(uniqueName): + del OnscreenPanel.AllPanels[uniqueName] + self.panelSetup = 0 return 1