crash while running the examples in OSX 10.8 (mountain lion)

Official forum for the Chipmunk2D Physics Library.
Post Reply
estebanlm
Posts: 3
Joined: Tue Nov 13, 2012 8:30 am
Contact:

crash while running the examples in OSX 10.8 (mountain lion)

Post by estebanlm »

Hi,

I'm new to the list, and to chipmunk, and to game development :)
In fact, I'm not trying to do a game but a series of graphical experiments (for a kind of UI), and I need to simulate physics using Pharo (http://pharo-project.org) and Chipmunk.

Well, I just downloaded the library and opened the xcode projects and ran the demo to check what can I expect to replicate and I got a crash in the 3rd example (which of course, I don't know what it should show :)

The error occurs here:

cpPostStepCallback *
cpSpaceGetPostStepCallback(cpSpace *space, void *key)
{
cpArray *arr = space->postStepCallbacks;
for(int i=0; i<arr->num; i++){
cpPostStepCallback *callback = (cpPostStepCallback *)arr->arr;
if(callback->key == key) return callback; // <-- HERE
}

return NULL;
}

and because callback == NULL.

So, I really would like to have this examples running...

someone can help me?

Thanks,
Esteban
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: crash while running the examples in OSX 10.8 (mountain l

Post by slembcke »

The Chipmunk 6.1.2 package from the website? I'll have to look into it and see if I can replicate the issue. I run the demos almost daily when developing Chipmunk and haven't run into anything. Not sure what's up with that.

The third demo also doesn't define any callbacks of any sort. Not sure why arr->num would be anything other than zero. If the crash happens again, could you use the debugger to get the value of arr->num?
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: crash while running the examples in OSX 10.8 (mountain l

Post by slembcke »

Hrm. I have absolutely no idea what could cause that bug other than a memory smasher somewhere. The Plink demo never adds any post step callbacks, the array of post step callbacks is created with calloc() so it can't be accidentally reading garbage (and it really should have been crashing on that for years now if that was the case).

If you can replicate the issue any information you can give me about it would be helpful.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
estebanlm
Posts: 3
Joined: Tue Nov 13, 2012 8:30 am
Contact:

Re: crash while running the examples in OSX 10.8 (mountain l

Post by estebanlm »

Hi,

yes, the version is Chipmunk 6.1.2 (from the site).
btw, I really don't know if is "the third" demo. I just pressed "w" twice, is the one who comes after "Sticky Surfaces".

Code: Select all

arr->num = 62
i = 0
...and callback is still NULL 
bt:

Code: Select all

* thread #1: tid = 0x1d07, 0x000000010003f859 ChipmunkDemo`cpSpaceGetPostStepCallback + 73 at cpSpaceStep.c:32, stop reason = EXC_BAD_ACCESS (code=1, address=0x8)
    frame #0: 0x000000010003f859 ChipmunkDemo`cpSpaceGetPostStepCallback + 73 at cpSpaceStep.c:32
    frame #1: 0x000000010003f904 ChipmunkDemo`cpSpaceAddPostStepCallback + 100 at cpSpaceStep.c:47
    frame #2: 0x000000010002012c ChipmunkDemo`StickySeparate + 92 at Sticky.c:89
    frame #3: 0x000000010003c14f ChipmunkDemo`cpArbiterCallSeparate + 79 at chipmunk_private.h:251
    frame #4: 0x000000010003b65e ChipmunkDemo`cachedArbitersFilter + 190 at cpSpace.c:341
    frame #5: 0x000000010002e61f ChipmunkDemo`cpHashSetFilter + 127 at cpHashSet.c:241
    frame #6: 0x000000010003b58b ChipmunkDemo`cpSpaceFilterArbiters + 91 at cpSpace.c:358
    frame #7: 0x000000010003b7ab ChipmunkDemo`cpSpaceRemoveShape + 235 at cpSpace.c:374
    frame #8: 0x0000000100003081 ChipmunkDemo`shapeFreeWrap + 33 at ChipmunkDemo.c:90
    frame #9: 0x000000010003fb76 ChipmunkDemo`cpSpaceUnlock + 390 at cpSpaceStep.c:90
    frame #10: 0x000000010003bc37 ChipmunkDemo`cpSpaceEachShape + 135 at cpSpace.c:481
    frame #11: 0x0000000100000d26 ChipmunkDemo`ChipmunkDemoFreeSpaceChildren + 38 at ChipmunkDemo.c:121
    frame #12: 0x000000010001fdb5 ChipmunkDemo`destroy + 21 at Sticky.c:187
    frame #13: 0x0000000100001e53 ChipmunkDemo`keyboard + 99 at ChipmunkDemo.c:325
    frame #14: 0x00000001000a3797 GLUT`-[GLUTView keyDown:] + 342
    frame #15: 0x00007fff8e88c120 AppKit`-[NSWindow sendEvent:] + 9687
    frame #16: 0x000000010009e66b GLUT`-[GLUTWindow sendEvent:] + 39
    frame #17: 0x00007fff8e887744 AppKit`-[NSApplication sendEvent:] + 5761
    frame #18: 0x00000001000ac107 GLUT`-[GLUTApplication _runMainLoopUntilDate:autoreleasePool:] + 177
    frame #19: 0x00000001000ac251 GLUT`-[GLUTApplication run] + 294
    frame #20: 0x00000001000b90ec GLUT`glutMainLoop + 267
    frame #21: 0x0000000100001777 ChipmunkDemo`main + 1575 at ChipmunkDemo.c:626
    frame #22: 0x0000000100000cd4 ChipmunkDemo`start + 52
thanks,
Esteban
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: crash while running the examples in OSX 10.8 (mountain l

Post by slembcke »

Ah. That's actually the last demo (they are keyed a through w). Looks like the issue is a regression that's triggered when the demo is exited. I'm guessing I didn't notice it because I quit once I got to the last demo and never switched out of it or restarted it. -_-

Anyway, I pushed a fix to the github project:
https://github.com/slembcke/Chipmunk-Physics
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests