mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
added printCreationStackTrace to Functors in __dev__
This commit is contained in:
parent
601f094d8d
commit
1892796e2a
@ -2907,8 +2907,11 @@ def recordCreationStack(cls):
|
|||||||
return self.__moved_init__(*args, **kArgs)
|
return self.__moved_init__(*args, **kArgs)
|
||||||
def getCreationStackTrace(self):
|
def getCreationStackTrace(self):
|
||||||
return self._creationStackTrace
|
return self._creationStackTrace
|
||||||
|
def printCreationStackTrace(self):
|
||||||
|
print self._creationStackTrace
|
||||||
cls.__init__ = __recordCreationStack_init__
|
cls.__init__ = __recordCreationStack_init__
|
||||||
cls.getCreationStackTrace = getCreationStackTrace
|
cls.getCreationStackTrace = getCreationStackTrace
|
||||||
|
cls.printCreationStackTrace = printCreationStackTrace
|
||||||
return cls
|
return cls
|
||||||
|
|
||||||
|
|
||||||
@ -3204,6 +3207,14 @@ def logBlock(id, msg):
|
|||||||
print str(msg)
|
print str(msg)
|
||||||
print '/LOGBLOCK(%03d) >>' % id
|
print '/LOGBLOCK(%03d) >>' % id
|
||||||
|
|
||||||
|
# __dev__ is not defined at import time, call this after it's defined
|
||||||
|
def recordFunctorCreationStacks():
|
||||||
|
global Functor
|
||||||
|
if __dev__:
|
||||||
|
if not hasattr(Functor, '_functorCreationStacksRecorded'):
|
||||||
|
Functor = recordCreationStack(Functor)
|
||||||
|
Functor._functorCreationStacksRecorded = True
|
||||||
|
|
||||||
import __builtin__
|
import __builtin__
|
||||||
__builtin__.Functor = Functor
|
__builtin__.Functor = Functor
|
||||||
__builtin__.Stack = Stack
|
__builtin__.Stack = Stack
|
||||||
|
@ -20,6 +20,7 @@ from direct.task.TaskManagerGlobal import *
|
|||||||
from JobManagerGlobal import *
|
from JobManagerGlobal import *
|
||||||
from EventManagerGlobal import *
|
from EventManagerGlobal import *
|
||||||
from PythonUtil import *
|
from PythonUtil import *
|
||||||
|
from direct.showbase import PythonUtil
|
||||||
from direct.particles.ParticleManagerGlobal import *
|
from direct.particles.ParticleManagerGlobal import *
|
||||||
from PhysicsManagerGlobal import *
|
from PhysicsManagerGlobal import *
|
||||||
#from direct.interval.IntervalManager import ivalMgr
|
#from direct.interval.IntervalManager import ivalMgr
|
||||||
@ -317,6 +318,9 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
|
|
||||||
ShowBase.notify.info('__dev__ == %s' % __dev__)
|
ShowBase.notify.info('__dev__ == %s' % __dev__)
|
||||||
|
|
||||||
|
# set up recording of Functor creation stacks in __dev__
|
||||||
|
PythonUtil.recordFunctorCreationStacks()
|
||||||
|
|
||||||
if __dev__ or self.config.GetBool('want-e3-hacks', False):
|
if __dev__ or self.config.GetBool('want-e3-hacks', False):
|
||||||
if self.config.GetBool('track-gui-items', True):
|
if self.config.GetBool('track-gui-items', True):
|
||||||
# dict of guiId to gui item, for tracking down leaks
|
# dict of guiId to gui item, for tracking down leaks
|
||||||
|
Loading…
x
Reference in New Issue
Block a user