Page 1 of 1

Infinite loop on FloodFillComponent

Posted: Fri Jun 27, 2014 2:19 am
by o-simon
I have an infinite loop.

In the stack trace:

cpSpaceStep
cpSpaceProcessComponents
FloodFillComponent
CP_BODY_FOREACH_ARBITER(body, arb) FloodFillComponent(root, (body == arb->body_a ? arb->body_b : arb->body_a));

There is one cpArbiter whose thread_a.prev and thread_a.next are himself. Hence, CP_BODY_FOREACH_ARBITER never returns.

In my case I can reproduce this every time. I set

cpSpaceSetSleepTimeThreshold( pSpace, 10.0 );

when the sleep threshold occurs, Chipmunk goes into infinite loop. My space consists of:

- 1 static body, a planet.
- 1 rogue body, a paddle, never in contact with the planet.
- 1 dynamic body, the user ball. The user uses the paddle to bounce the ball towards the planet.
- 10 dynamic bodies, balls resting on the planet, the targets of the user ball.

Any hints on why this might be happening?

Re: Infinite loop on FloodFillComponent

Posted: Fri Jun 27, 2014 2:34 am
by o-simon
I was wrong, it doesn't go into an infinite loop after the sleep threshold time. It happens when the dynamic user ball:

- bounces off the rogue body twice in a row, or
- after bouncing off the rogue body, touches the static body

Any hints on what might be the problem?