I am picking up a wrapper someone else made of Bullet and am testing/learning about both the wrapper and Bullet.
I am running into a double free issue related to when I shutdown and cleanup. I think the problem is when stopSPU in the PosixThreadSupport class gets called more than once for the same instance of the object (It gets called in the PosixThreadSupport destructor). There are no checks in the stopSPU method to prevent the main semephore from getting deleted twice. The only other calls to stopSPU are in the SpuCollisionTaskProcess class and the SpuSampleTaskProcess class.
When I am cleaning up the Bullet stuff in my code the stopSPU method is getting called twice causing a double free of the main semaphore. I also verified that the MultiThreadedDemo application does the same thing using valgrind after I uncommented out the BT_USE_FREEGLUT flag (before the demo would just exit with the q key and never perform any cleanup
I would think that the first piece of a possible fix would be to make the PosixThreadSupport::stopSPU method not delete a semaphore which was already deleted. The second part would be to determine if the multiple calls to stopSPU is correct or not.
Let me know if you agree with me or not. If you do I will create a ticket and might work on a possible patch as well.