mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-17 20:23:47 -04:00
fix crash after switching avatars
This commit is contained in:
parent
584b17159d
commit
5cd64e3a4d
@ -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):
|
||||
"""
|
||||
|
@ -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)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user