I just started playing with 5.3.4 and my test app keeps getting seg faults after a minute or two (seemingly randomly, but a noticably short period after a collision). After beating my head I put little breakpoints in my code and the library and narrowed it down to cpSpaceEachBody() following the next=body->node.next to NULL.
It is still possible that I am improperly tickling the space->sleepingComponents somehow because in the eachBody() iterator I have it performing
a if cpBodyIsSleeping then apply cpBodySetVel... (thats all the function does at the moment FYI)
Any tips on how to work around this (or a "You're doing it wrong!") would be helpful.
Thanks!
Possible problem with cpSpaceEachBody deferencing NULL?
-
- Posts: 3
- Joined: Thu Mar 10, 2011 3:55 am
- Contact:
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Possible problem with cpSpaceEachBody deferencing NULL?
Ah, yep that's a bug. The problem is that cpSpaceEachBody() doesn't lock the space but it should. When iterating it's data structures (during cpSpaceStep() and queries), a cpSpace is locked so that it knows to throw an error when you try to add/remove something. It also builds a list of bodies to be awoken when the the lock is released as waking a body requires moving thing around between data structures. It never occurred to me that cpSpaceEachBody() would have the same problem.
I fixed it in trunk.
I fixed it in trunk.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 3
- Joined: Thu Mar 10, 2011 3:55 am
- Contact:
Re: Possible problem with cpSpaceEachBody deferencing NULL?
You rock! Thanks for the insanely fast fix.
Heres the output of the test program
http://www.youtube.com/watch?v=suSLUs_0bo0
Heres the output of the test program
http://www.youtube.com/watch?v=suSLUs_0bo0
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Possible problem with cpSpaceEachBody deferencing NULL?
Wow. That is very cool. Care to share a little more info? I'd like to make a blog post about that if you wouldn't mind.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 3
- Joined: Thu Mar 10, 2011 3:55 am
- Contact:
Re: Possible problem with cpSpaceEachBody deferencing NULL?
No problem... I'll have more interesting stuff coded up tonight!
You might recognize the physics engine, but the display hardware is using a 2 watt whitelight laser with 30kpps galvos. We built our own laser control hardware and software. The system is focused on real-time laser effects for laser shows. You can see the interactive nature in this video. http://www.youtube.com/watch?v=JKAqTKxyI8g (This video wasn't taken by us, we handed the ipad out at SOCALEM)
laser controller, features true 16 bit X & Y axis positioning and 64-bit color control.
laser.
You might recognize the physics engine, but the display hardware is using a 2 watt whitelight laser with 30kpps galvos. We built our own laser control hardware and software. The system is focused on real-time laser effects for laser shows. You can see the interactive nature in this video. http://www.youtube.com/watch?v=JKAqTKxyI8g (This video wasn't taken by us, we handed the ipad out at SOCALEM)
laser controller, features true 16 bit X & Y axis positioning and 64-bit color control.
laser.
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Possible problem with cpSpaceEachBody deferencing NULL?
Very cool. I shared the link around with some friends and basically everybody's reaction was "I want one!". Heh.
I wish I had the time to do more with electronics stuff. I used to be really interested in it when I was a kid, but programming takes up most of my time now. It's still pretty cool that people are using my code to do stuff like that.
I wish I had the time to do more with electronics stuff. I used to be really interested in it when I was a kid, but programming takes up most of my time now. It's still pretty cool that people are using my code to do stuff like that.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Who is online
Users browsing this forum: No registered users and 2 guests