Hey,
Thank you both for the replies, I really didn’t expect to get any replies because this problem seemed uncommon.
Can I find out where the body is being created while the world is locked? The game seems to crash when I fire a “bullet”, but I’ve added a check using if (!world.isLocked()) before creating a body.
I’m using the Oracle JDK, and I’ve just reinstalled JRE and the problem is still there.
I can see that it’s crashing at Projectile.initialise(), but I’m checking the whole initialise() method to make sure that world.isLocked() is false.
The error is being trigged in here somewhere:
public void initialise() {
if (!world.isLocked()) {
Gameplay.worldBusy = true;
shape.setAsBox(hwidth, hheight);
body = world.createBody(bodyDef);
body.setTransform(initPos.x, initPos.y, 0);
fixture = body.createFixture(fixtureDef);
body.applyLinearImpulse(initImpulse, body.getLocalCenter(),
true);
Gameplay.worldBusy = false;
}
}
but I can’t see a problem with it. I’m already checking that the world isn’t locked. Can anyone see a problem that would cause the error?
I’ve even made sure that the world doesn’t step if the boolean worldBusy is true, so it can’t be creating a body while stepping.
Edit: Well I’ve spent pretty much the whole day trying to solve this but still can’t :(. Is there a temporary solution to suppress this error (kinda like how you would catch an exception), so that the program will keep running?
I’ve been playing around with the game, and it seems to crash when I try to fire while a Projectile(body) is being destroyed at the same time. Can’t say for sure that this is the problem, but it feels like it when playing. For now I’m just going to make the projectiles that the weapons fire sensors; hopefully that’ll get rid of the problem for now.