Clear PhysicsSpace [Patch]

Hi super devs!

I found that PhysicsSpace class has issues in destroy() method.
When destroy() is called then not all stuff is cleared (tickListeners, CharacterControls, physicsGhostObjects, collisionGroupListeners, etc).

Here is my patch:
https://dl.dropboxusercontent.com/u/26887202/JME/physicsSpace_clear_01.patch

Just inform me when you put it.

And for checking what i did: https://code.google.com/p/jmonkeyengine/source/browse/branches/gradle-restructure/jme3-jbullet/src/main/java/com/jme3/bullet/PhysicsSpace.java?r=11110

Check the destroy() method and check lines 107-115 (these objects are not cleared).

Thanks.

The destroy method is only there to be able to call the bullet destroy method, the objects only get removed because bullet removes these from the physics space and native crashes if they het garbage collected instead.

@normen said: The destroy method is only there to be able to call the bullet destroy method, the objects only get removed because bullet removes these from the physics space and native crashes if they het garbage collected instead.

Can we clear Listeners? Will there be a crash if clear all of them?

[java]
collisionGroupListeners.clear();
tickListeners.clear();
collisionListeners.clear();
[/java]

Ok, thanks for such funny answer, at least.