fix crash after switching avatars

This commit is contained in:
David Rose 2003-12-02 21:48:26 +00:00
parent 584b17159d
commit 5cd64e3a4d
2 changed files with 29 additions and 3 deletions

View File

@ -37,8 +37,13 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
# other.
self.relatedObjectMgr = RelatedObjectMgr.RelatedObjectMgr(self)
def delete(self):
self.relatedObjectMgr.destroy()
def abruptCleanup(self):
"""
Call this method to clean up any pending hooks or tasks on
distributed objects, but leave the ClientRepository in a sane
state for creating more distributed objects.
"""
self.relatedObjectMgr.abortAllRequests()
def setServerDelta(self, delta):
"""

View File

@ -36,9 +36,9 @@ class RelatedObjectMgr(DirectObject.DirectObject):
self.pendingObjects = {}
def destroy(self):
self.abortAllRequests()
del self.cr
del self.pendingObjects
self.ignoreAll()
def requestObjects(self, doIdList, allCallback = None, eachCallback = None,
timeout = None, timeoutCallback = None):
@ -148,6 +148,27 @@ class RelatedObjectMgr(DirectObject.DirectObject):
taskMgr.remove(doLaterName)
self.__removePending(tuple, doIdsPending)
def abortAllRequests(self):
"""
Call this method to abruptly abort all pending requests, but
leave the RelatedObjectMgr in a state for accepting more
requests.
"""
# Stop listening for all events.
self.ignoreAll()
# Iterate through all the pendingObjects and stop any pending
# tasks.
for pendingList in self.pendingObjects.values():
for tuple in pendingList:
allCallback, eachCallback, timeoutCallback, doIdsPending, doIdList, doLaterName = tuple
if doLaterName:
taskMgr.remove(doLaterName)
self.pendingObjects = {}
def __timeoutExpired(self, tuple):
allCallback, eachCallback, timeoutCallback, doIdsPending, doIdList, doLaterName = tuple
assert(self.notify.debug("timeout expired for %s (remaining: %s)" % (doIdList, doIdsPending)))