mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-21 14:41:11 -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.
|
# other.
|
||||||
self.relatedObjectMgr = RelatedObjectMgr.RelatedObjectMgr(self)
|
self.relatedObjectMgr = RelatedObjectMgr.RelatedObjectMgr(self)
|
||||||
|
|
||||||
def delete(self):
|
def abruptCleanup(self):
|
||||||
self.relatedObjectMgr.destroy()
|
"""
|
||||||
|
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):
|
def setServerDelta(self, delta):
|
||||||
"""
|
"""
|
||||||
|
@ -36,9 +36,9 @@ class RelatedObjectMgr(DirectObject.DirectObject):
|
|||||||
self.pendingObjects = {}
|
self.pendingObjects = {}
|
||||||
|
|
||||||
def destroy(self):
|
def destroy(self):
|
||||||
|
self.abortAllRequests()
|
||||||
del self.cr
|
del self.cr
|
||||||
del self.pendingObjects
|
del self.pendingObjects
|
||||||
self.ignoreAll()
|
|
||||||
|
|
||||||
def requestObjects(self, doIdList, allCallback = None, eachCallback = None,
|
def requestObjects(self, doIdList, allCallback = None, eachCallback = None,
|
||||||
timeout = None, timeoutCallback = None):
|
timeout = None, timeoutCallback = None):
|
||||||
@ -148,6 +148,27 @@ class RelatedObjectMgr(DirectObject.DirectObject):
|
|||||||
taskMgr.remove(doLaterName)
|
taskMgr.remove(doLaterName)
|
||||||
self.__removePending(tuple, doIdsPending)
|
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):
|
def __timeoutExpired(self, tuple):
|
||||||
allCallback, eachCallback, timeoutCallback, doIdsPending, doIdList, doLaterName = tuple
|
allCallback, eachCallback, timeoutCallback, doIdsPending, doIdList, doLaterName = tuple
|
||||||
assert(self.notify.debug("timeout expired for %s (remaining: %s)" % (doIdList, doIdsPending)))
|
assert(self.notify.debug("timeout expired for %s (remaining: %s)" % (doIdList, doIdsPending)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user