Browse Source

bullet: Fixed crash when rendering bulletDebugNode

        - Fixed crash when rendering bulletDebugNode without calls
        to doPhysics. This is caused by _debug_world pointing to
        invalid memory, while _debug_stale is true when bulletDebugNode
        is initialized.

Signed-off-by: deflected <[email protected]>
deflected 7 years ago
parent
commit
ce79656141
2 changed files with 4 additions and 1 deletions
  1. 3 1
      panda/src/bullet/bulletDebugNode.cxx
  2. 1 0
      panda/src/bullet/bulletWorld.cxx

+ 3 - 1
panda/src/bullet/bulletDebugNode.cxx

@@ -31,8 +31,10 @@ PStatCollector BulletDebugNode::_pstat_debug("App:Bullet:DoPhysics:Debug");
  *
  */
 BulletDebugNode::
-BulletDebugNode(const char *name) : PandaNode(name), _debug_stale(true) {
+BulletDebugNode(const char *name) : PandaNode(name) {
 
+  _debug_stale = false;
+  _debug_world = nullptr;
   _wireframe = true;
   _constraints = true;
   _bounds = false;

+ 1 - 0
panda/src/bullet/bulletWorld.cxx

@@ -134,6 +134,7 @@ void BulletWorld::
 clear_debug_node() {
   if (_debug != nullptr) {
     LightMutexHolder holder(_debug->_lock);
+    _debug->_debug_stale = false;
     _debug->_debug_world = nullptr;
     _world->setDebugDrawer(nullptr);
     _debug = nullptr;