xiangaodielian / bullet

Automatically exported from code.google.com/p/bullet
Other
0 stars 0 forks source link

Crash in AllBulletDemos due to calling delete on non-heap variables. #608

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The CcdPhysicsDemo uses a global static variable:
static GLDebugDrawer sDebugDrawer
m_dynamicsWorld->setDebugDrawer(&sDebugDrawer);

In AllBulletDemos/Main.cpp, line #343 leads to a crash:
delete demo->getDynamicsWorld()->getDebugDrawer();

At least one other demo does this as well:
ConcaveRaycastDemo.cpp

Original issue reported on code.google.com by tnbak...@shaw.ca on 15 Mar 2012 at 5:38

GoogleCodeExporter commented 9 years ago
Even though CreatDemo() allocates a new GLDebugDrawer() for each demo, 
CcdPhysicsDemo::initPhysics() may reset this to the static sDebugDrawer.

Original comment by tnbak...@shaw.ca on 15 Mar 2012 at 5:42

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r2532.

Original comment by erwin.coumans on 15 Mar 2012 at 9:57

GoogleCodeExporter commented 9 years ago
Strange, it didn't crash here so I didn't ran into it but it was surely wrong.

Fixed in latest trunk, thanks for the report!
http://code.google.com/p/bullet/source/detail?r=2532

Original comment by erwin.coumans on 15 Mar 2012 at 9:57