From 3f4258953267014ed8ff961a9f166872300a4ef8 Mon Sep 17 00:00:00 2001 From: David Rose Date: Mon, 10 Jan 2005 17:31:08 +0000 Subject: [PATCH] protect against calling announceGenerate() and disable() twice --- direct/src/distributed/DistributedObject.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/direct/src/distributed/DistributedObject.py b/direct/src/distributed/DistributedObject.py index 09c6e49b20..4c9637787c 100644 --- a/direct/src/distributed/DistributedObject.py +++ b/direct/src/distributed/DistributedObject.py @@ -143,20 +143,22 @@ class DistributedObject(PandaObject): generated and all of its required fields filled in. """ assert(self.notify.debug('announceGenerate(): %s' % (self.doId))) - self.activeState = ESGenerated - messenger.send(self.uniqueName("generate"), [self]) + if self.activeState != ESGenerated: + self.activeState = ESGenerated + messenger.send(self.uniqueName("generate"), [self]) def disable(self): """ Inheritors should redefine this to take appropriate action on disable """ assert(self.notify.debug('disable(): %s' % (self.doId))) - self.activeState = ESDisabled - self.__callbacks = {} - if wantOtpServer: - self.cr.deleteObjectLocation(self.doId, self.__location[0], self.__location[1]) - self.__location = (None, None) - # TODO: disable my children + if self.activeState != ESDisabled: + self.activeState = ESDisabled + self.__callbacks = {} + if wantOtpServer: + self.cr.deleteObjectLocation(self.doId, self.__location[0], self.__location[1]) + self.__location = (None, None) + # TODO: disable my children def isDisabled(self): """