Page 1 of 1

How to solve a crash problem

Posted: Tue Apr 07, 2009 8:46 am
by Matkins
Hey everyone,

I've programmed a game that makes use of box2d physics, it seems to work nicely for a while, not getting any errors, BUT it randomly crashes--the window just closes suddenly. Objects are being created and destroyed approximately every second but theres hardly ever more than 2 objects in existance at the same time. It appears to happen on collision between an object and a sensor, or possibly on destroying the object (just to be clear i destroy both the body and the shape). The machine I'm using is powerful and should be able to handle this. One more thing, It seems totally unpredictable, i can sometimes use it for several minutes before it happens, and other time it'll crash much quicker.

What are the possible causes for crashes like this? If i know the possibilities i might be able to isolate the problem and fix it. Thanks.

Re: How to solve a crash problem

Posted: Tue Apr 07, 2009 9:22 am
by Gerrit
Hey, the same thing happened here. I had around 400 objects on the screen and it crashed. Not always at 400 but very often so I threw out the physics and working with my own collision detection now. Which will be released as a lib in a couple of days. So: I have no idea what causes the crash..

Re: How to solve a crash problem

Posted: Tue Apr 07, 2009 10:06 am
by Matkins
I appear to have solved my problem now. It was to do with using sensors to destroy objects. I suspect that theres some sort of overlap between the object actually being destroyed and the collision trigger being called for a second time, somehow, so it was trying to destroy an already destroyed object maybe. Thats just my theory. So, either don't uses sensors for this purpose, or put in a condition to ensure the collision callback can only be called once for each specific object.

Re: How to solve a crash problem

Posted: Wed Nov 25, 2009 9:32 pm
by igor
I have the same problem. In my application i destroy objects and their shapes when they collied (call :destroy() functions) and sometimes LOVE crashed (just close window). I think this problem happened when physics engine trying to get access to dead body object. Suggest me please, how to solve this problem.

PS: Nice to have love ingine log with warnings and errors occured. Sorry for the bad english)