Tuesday, July 29, 2008

Hunting a crash

Trying to hunt down a tricky crash bug. When two objects collide in the editor, cpCollideShapes chokes on a NULL pointer, that I can't find since I can't do source level debugging. I've thrifted through the entire level setup, and the editor data takes the same routes as do the game data. The only possible thing I cant think of is that the editor somehow deletes memory somewhere, but have almost no release events... […] Only seems to affect Pucks...

Both the shapes and both the bodies are in the physicsSpace. Exporting the editor's data and running it from the game works fine.

After two hours, I found the culprit. I was taking a code path that did not call cpInitChipmunk(). I added an app delegate to handle it, and now it's working perfectly. I can create pucks and an environment, and have them bounce around. Tomorrow: reset functionality and test writing.

No comments: