Browse Source

fix startup crash

Darren Ranalli 18 years ago
parent
commit
7e54ae47b7
2 changed files with 12 additions and 4 deletions
  1. 4 1
      direct/src/gui/DirectGuiBase.py
  2. 8 3
      direct/src/task/Task.py

+ 4 - 1
direct/src/gui/DirectGuiBase.py

@@ -651,7 +651,10 @@ def toggleGuiGridSnap():
 def setGuiGridSpacing(spacing):
 def setGuiGridSpacing(spacing):
     DirectGuiWidget.gridSpacing = spacing
     DirectGuiWidget.gridSpacing = spacing
 
 
-if __dev__:
+# this should trigger off of __dev__, but it's not available at this point.
+# __debug__ works because the production client is not __debug__ and the
+# production AI doesn't create any GUI.
+if config.GetBool('record-gui-creation-stack', __debug__):
     # this will help track down the code that created DirectGui objects
     # this will help track down the code that created DirectGui objects
     # call obj.getCreationStackTrace() to figure out what code created it
     # call obj.getCreationStackTrace() to figure out what code created it
     DirectGuiBase = recordCreationStack(DirectGuiBase)
     DirectGuiBase = recordCreationStack(DirectGuiBase)

+ 8 - 3
direct/src/task/Task.py

@@ -76,9 +76,14 @@ class Task:
         debugTaskTraceback = 0 # base.config.GetBool('debug-task-traceback', 0)
         debugTaskTraceback = 0 # base.config.GetBool('debug-task-traceback', 0)
     count = 0
     count = 0
     def __init__(self, callback, priority = 0):
     def __init__(self, callback, priority = 0):
-        if __dev__:
-            if self.debugTaskTraceback:
-                self.debugInitTraceback = StackTrace("Task "+str(callback), 1, 10)
+        try:
+            config
+        except:
+            pass
+        else:
+            if config.GetBool('record-task-creation-stack', __dev__):
+                if self.debugTaskTraceback:
+                    self.debugInitTraceback = StackTrace("Task "+str(callback), 1, 10)
         # Unique ID for each task
         # Unique ID for each task
         self.id = Task.count
         self.id = Task.count
         Task.count += 1
         Task.count += 1