Hingle gives error when exiting the game, why?

Hi.



I got this door, and everytime my map contains that door the following will be printed when exiting the game:

ALLVARLIG: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.NullPointerException
at com.bulletphysics.collision.dispatch.CollisionDispatcher.freeCollisionAlgorithm(CollisionDispatcher.java:119)
at com.bulletphysics.collision.dispatch.CompoundCollisionAlgorithm.destroy(CompoundCollisionAlgorithm.java:76)
at com.bulletphysics.collision.dispatch.CollisionDispatcher.freeCollisionAlgorithm(CollisionDispatcher.java:120)
at com.bulletphysics.collision.dispatch.CompoundCollisionAlgorithm.destroy(CompoundCollisionAlgorithm.java:76)
at com.bulletphysics.collision.dispatch.CollisionDispatcher.freeCollisionAlgorithm(CollisionDispatcher.java:120)
at com.bulletphysics.collision.broadphase.HashedOverlappingPairCache.cleanOverlappingPair(HashedOverlappingPairCache.java:219)
at com.bulletphysics.collision.broadphase.HashedOverlappingPairCache$CleanPairCallback.processOverlap(HashedOverlappingPairCache.java:447)
at com.bulletphysics.collision.broadphase.HashedOverlappingPairCache.processAllOverlappingPairs(HashedOverlappingPairCache.java:190)
at com.bulletphysics.collision.broadphase.HashedOverlappingPairCache.cleanProxyFromPairs(HashedOverlappingPairCache.java:207)
at com.bulletphysics.collision.dispatch.CollisionWorld.destroy(CollisionWorld.java:95)
at com.jme3.bullet.PhysicsSpace.destroy(PhysicsSpace.java:758)
at com.jme3.bullet.BulletAppState.cleanup(BulletAppState.java:213)
at com.jme3.app.state.AppStateManager.cleanup(AppStateManager.java:195)
at com.jme3.app.Application.destroy(Application.java:593)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.deinitInThread(LwjglAbstractDisplay.java:189)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:223)
at java.lang.Thread.run(Unknown Source)


The door is created like the following:
[java]shape = ShapeManager.ShapeMesh("Door_1","Door_2.jpg");
shape.setName(String.valueOf(WorldManager.getID()));
shape.setLocalScale(2);
this.pos = pos;
setup();


this.setEnabled(true);
MainClass.app.getStateManager().attach(this);[/java]

where as setup is this:
[java]public void setup(){
try{
//shape.removeControl(door);
shape.setLocalTranslation(0,0,0);

//pNode.attachChild(shape);
CollisionShape sceneShape = CollisionShapeFactory.createMeshShape(shape);

Node holderNode = PhysicsTestHelper.createPhysicsTestNode(MainClass.getAsset(), new BoxCollisionShape(new Vector3f( .1f, .1f, .1f)),0);
System.out.println(pos);
RigidBodyControl holder = holderNode.getControl(RigidBodyControl.class);
holder.setPhysicsLocation(new Vector3f(0f,-1,0f).add(pos));
MainClass.getRoot().attachChild(holderNode);
MainClass.getPhysics().add(holder);

Node hammerNode = PhysicsTestHelper.createPhysicsTestNode(MainClass.getAsset(), sceneShape,1);
door = hammerNode.getControl(RigidBodyControl.class);
door.setPhysicsLocation(new Vector3f(0f,0,0f).add(pos));

hammerNode.attachChild(shape);
MainClass.getRoot().attachChild(hammerNode);
MainClass.getPhysics().add(door);


joint=new HingeJoint(holder, door, Vector3f.ZERO, new Vector3f(0f,-1,0f), Vector3f.UNIT_Y, Vector3f.UNIT_Y);
MainClass.getPhysics().add(joint);
joint.setLimit(-2.5f, 2.5f);

joint.setCollisionBetweenLinkedBodys(false);



} catch (Exception e){
e.printStackTrace();
}
}[/java]

And there is no error except:
warning CollisionDispatcher.needsCollision: static-static collision!
when the game starts.


Should I use some sort of terminate on all hinges before quiting?

You probably remove or add an object twice from the physics space.