浏览代码

*** empty log message ***

Jesse Schell 25 年之前
父节点
当前提交
22fd93e50f
共有 1 个文件被更改,包括 8 次插入4 次删除
  1. 8 4
      direct/src/showbase/Messenger.py

+ 8 - 4
direct/src/showbase/Messenger.py

@@ -121,10 +121,14 @@ class Messenger:
                 # If this object was only accepting this event once,
                 # remove it from the dictionary
                 if not persistent:
-                    del acceptorDict[object]
-                    # If this dictionary is now empty, remove the event
-                    # entry from the Messenger alltogether
-                    if (len(acceptorDict) == 0):
+                    # We need to check this because the apply above might
+                    # have done an ignore.
+                    if acceptorDict.has_key(object):
+                        del acceptorDict[object]
+                        # If this dictionary is now empty, remove the event
+                        # entry from the Messenger alltogether
+                    if ((len(acceptorDict) == 0) and
+                        (self.dict.has_key(event))):
                         del self.dict[event]
 
     def clear(self):