mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
catch exceptions in subjobs so AI won't crash
This commit is contained in:
parent
c1ec8b0fb3
commit
da6d5fc3b9
@ -320,6 +320,7 @@ class FindContainers(Job):
|
|||||||
self._id2ref[contId] = objRef
|
self._id2ref[contId] = objRef
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
try:
|
||||||
while True:
|
while True:
|
||||||
# yield up here instead of at the end, since we skip back to the
|
# yield up here instead of at the end, since we skip back to the
|
||||||
# top of the while loop from various points
|
# top of the while loop from various points
|
||||||
@ -477,6 +478,12 @@ class FindContainers(Job):
|
|||||||
del childName
|
del childName
|
||||||
del child
|
del child
|
||||||
continue
|
continue
|
||||||
|
except Exception, e:
|
||||||
|
print 'FindContainers job caught exception: %s' % e
|
||||||
|
if __dev__:
|
||||||
|
#raise e
|
||||||
|
pass
|
||||||
|
yield Job.done
|
||||||
|
|
||||||
class CheckContainers(Job):
|
class CheckContainers(Job):
|
||||||
"""
|
"""
|
||||||
@ -499,6 +506,7 @@ class CheckContainers(Job):
|
|||||||
return Job.Priorities.Normal
|
return Job.Priorities.Normal
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
try:
|
||||||
self._leakDetector._index2containerId2len[self._index] = {}
|
self._leakDetector._index2containerId2len[self._index] = {}
|
||||||
ids = self._leakDetector.getContainerIds()
|
ids = self._leakDetector.getContainerIds()
|
||||||
# record the current len of each container
|
# record the current len of each container
|
||||||
@ -542,6 +550,7 @@ class CheckContainers(Job):
|
|||||||
self._leakDetector._index2containerId2len[self._index][id] = cLen
|
self._leakDetector._index2containerId2len[self._index][id] = cLen
|
||||||
# compare the current len of each container to past lens
|
# compare the current len of each container to past lens
|
||||||
if self._index > 0:
|
if self._index > 0:
|
||||||
|
oashdfjkahsdf
|
||||||
idx2id2len = self._leakDetector._index2containerId2len
|
idx2id2len = self._leakDetector._index2containerId2len
|
||||||
for id in idx2id2len[self._index]:
|
for id in idx2id2len[self._index]:
|
||||||
yield None
|
yield None
|
||||||
@ -610,6 +619,11 @@ class CheckContainers(Job):
|
|||||||
self.notify.info('sending notification...')
|
self.notify.info('sending notification...')
|
||||||
yield None
|
yield None
|
||||||
messenger.send(self._leakDetector.getLeakEvent(), [container, name])
|
messenger.send(self._leakDetector.getLeakEvent(), [container, name])
|
||||||
|
except Exception, e:
|
||||||
|
print 'CheckContainers job caught exception: %s' % e
|
||||||
|
if __dev__:
|
||||||
|
#raise e
|
||||||
|
pass
|
||||||
yield Job.Done
|
yield Job.Done
|
||||||
|
|
||||||
class PruneContainerRefs(Job):
|
class PruneContainerRefs(Job):
|
||||||
@ -631,6 +645,7 @@ class PruneContainerRefs(Job):
|
|||||||
return Job.Priorities.Normal
|
return Job.Priorities.Normal
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
try:
|
||||||
ids = self._leakDetector.getContainerIds()
|
ids = self._leakDetector.getContainerIds()
|
||||||
for id in ids:
|
for id in ids:
|
||||||
yield None
|
yield None
|
||||||
@ -641,6 +656,11 @@ class PruneContainerRefs(Job):
|
|||||||
except:
|
except:
|
||||||
# reference is invalid, remove it
|
# reference is invalid, remove it
|
||||||
self._leakDetector.removeContainerById(id)
|
self._leakDetector.removeContainerById(id)
|
||||||
|
except Exception, e:
|
||||||
|
print 'PruneContainerRefs job caught exception: %s' % e
|
||||||
|
if __dev__:
|
||||||
|
#raise e
|
||||||
|
pass
|
||||||
yield Job.Done
|
yield Job.Done
|
||||||
|
|
||||||
class ContainerLeakDetector(Job):
|
class ContainerLeakDetector(Job):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user