Ok. I pushed the fix to GitHub. I didn't go and make a test for every border case I could think of, but it was passing all the ones I did implement. I ended up finding one other obscure bug in the process. The performance of cpSpaceRemoveShape() should still be ok, though I did have to add the linear search of the cached arbiter set back.

Oh well, at least the implementation is a lot simpler... and correct.
The performance fix added in Chipmunk 6 for adding/removing static shapes didn't need to change at all. So that's still there.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/