Browse Source

auto-destroy

Darren Ranalli 19 years ago
parent
commit
3fcd37e21c
1 changed files with 4 additions and 2 deletions
  1. 4 2
      direct/src/showbase/BulletinBoardWatcher.py

+ 4 - 2
direct/src/showbase/BulletinBoardWatcher.py

@@ -31,8 +31,9 @@ class BulletinBoardWatcher(DirectObject.DirectObject):
 
 
     def destroy(self):
     def destroy(self):
         self.ignoreAll()
         self.ignoreAll()
-        del self.callback
-        del self.waitingOn
+        if hasattr(self, 'callback'):
+            del self.callback
+            del self.waitingOn
 
 
     def isDone(self):
     def isDone(self):
         return len(self.waitingOn) == 0
         return len(self.waitingOn) == 0
@@ -41,6 +42,7 @@ class BulletinBoardWatcher(DirectObject.DirectObject):
         if self.isDone():
         if self.isDone():
             self.notify.debug('%s: done' % self.name)
             self.notify.debug('%s: done' % self.name)
             self.callback()
             self.callback()
+            self.destroy()
 
 
     def _handleEvent(self, eventName):
     def _handleEvent(self, eventName):
         self.notify.debug('%s: handlePost(%s)' % (self.name, eventName))
         self.notify.debug('%s: handlePost(%s)' % (self.name, eventName))