From acddbc1997ab44531c1d8d4a797c72011b398512 Mon Sep 17 00:00:00 2001 From: Darren Ranalli Date: Tue, 27 Sep 2005 00:34:57 +0000 Subject: [PATCH] added channel range check before deallocation of channel--fixed Pirates tutorial crash --- direct/src/distributed/DistributedObjectAI.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/direct/src/distributed/DistributedObjectAI.py b/direct/src/distributed/DistributedObjectAI.py index b83a8f3102..aa6f6ad7ae 100644 --- a/direct/src/distributed/DistributedObjectAI.py +++ b/direct/src/distributed/DistributedObjectAI.py @@ -122,12 +122,17 @@ class DistributedObjectAI(DirectObject): barrier.cleanup() self.__barriers = {} - # Asad: As per Roger's suggestion, turn off the following block until a solution is - # Thought out of how to prevent this delete message or to handle this message better -## if not hasattr(self, "doNotDeallocateChannel"): -## if self.air: -## self.air.deallocateChannel(self.doId) -## self.air = None + # DCR: I've re-enabled this block of code so that Toontown's AI won't leak channels. + # Let me know if it causes trouble. + ### Asad: As per Roger's suggestion, turn off the following block until a solution is + ### Thought out of how to prevent this delete message or to handle this message better + # TODO: do we still need this check? + if not hasattr(self, "doNotDeallocateChannel"): + if self.air: + if self.air.minChannel <= self.doId <= self.air.maxChannel: + self.air.deallocateChannel(self.doId) + self.air = None + if hasattr(self, 'parentId'): del self.parentId if hasattr(self, 'zoneId'):