I thought this was a bug in our Java port, but I just looked through the C++ version and I see it there, too. I'm not sure, though, this might be expected behavior, just wanted to ask.
The issue is that when you add a shape to a bodydef, instead of the shape definition being copied, a pointer is stored instead. This means that you can't reuse the shapedef within the same bodydef because any changes will corrupt the already-placed shapes (though it is okay to reuse once the body has actually been created).
I can't think of a good reason why shapedefs should not be reusable but bodydefs should be, but let me know if this is, in fact, the desired behavior. If not, the fix is simple, just create a copy of the shapedef in AddShape instead of saving the pointer.
The issue is that when you add a shape to a bodydef, instead of the shape definition being copied, a pointer is stored instead. This means that you can't reuse the shapedef within the same bodydef because any changes will corrupt the already-placed shapes (though it is okay to reuse once the body has actually been created).
I can't think of a good reason why shapedefs should not be reusable but bodydefs should be, but let me know if this is, in fact, the desired behavior. If not, the fix is simple, just create a copy of the shapedef in AddShape instead of saving the pointer.