Browse Source

respect delayDelete when removing objects from cache

David Rose 23 years ago
parent
commit
6a7e96398d
2 changed files with 7 additions and 6 deletions
  1. 3 3
      direct/src/distributed/CRCache.py
  2. 4 3
      direct/src/distributed/DistributedObject.py

+ 3 - 3
direct/src/distributed/CRCache.py

@@ -19,7 +19,7 @@ class CRCache:
         assert(self.checkCache())
         CRCache.notify.debug("Flushing the cache")
         for distObj in self.dict.values():
-            distObj.delete()
+            distObj.deleteOrDelay()
         # Null out all references to the objects so they will get gcd
         self.dict = {}
         self.fifo = []
@@ -48,7 +48,7 @@ class CRCache:
                 # and remove it from the dictionary
                 del(self.dict[oldestDistObj.getDoId()])
                 # and delete it
-                oldestDistObj.delete()
+                oldestDistObj.deleteOrDelay()
                 
         # Make sure that the fifo and the dictionary are sane
         assert(len(self.dict) == len(self.fifo))
@@ -81,7 +81,7 @@ class CRCache:
         del(self.dict[doId])
         self.fifo.remove(distObj)
         # and delete it
-        distObj.delete()
+        distObj.deleteOrDelay()
         
     def checkCache(self):
         # For debugging; this verifies that the cache is sensible and

+ 4 - 3
direct/src/distributed/DistributedObject.py

@@ -123,9 +123,10 @@ class DistributedObject(PandaObject):
         # a normal, nondisabled state; and *then* the disable function
         # can properly disable it (for instance, by parenting it to
         # hidden).
-        self.activeState = ESDisabling
-        messenger.send(self.uniqueName("disable"))
-        self.disable()
+        if self.activeState != ESDisabled:
+            self.activeState = ESDisabling
+            messenger.send(self.uniqueName("disable"))
+            self.disable()
         return None
 
     def announceGenerate(self):