respect delayDelete when removing objects from cache

This commit is contained in:
David Rose 2002-10-28 17:47:53 +00:00
parent 54e997dbe0
commit 6a7e96398d
2 changed files with 7 additions and 6 deletions

View File

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

View File

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