It's a little difficult to explain the offending piece of code, as there seems to be some degree of stack corruption, and all the code's pretty linked together (it's a game). If you're looking for a headache and some debugging, please check out the segfault branch on git://github.com/RobotGymnast/Gingerbread.git and see if you can find what's causing the stack corruption/segfault. I marked my suspect with a #error
Here's the offending code (I think):
void Update()
{
// TODO: only check those that have moved
for(PhysicsObjectList::iterator collider = objects.begin(); collider != objects.end(); ++collider)
{
PhysicsObjectList::iterator collidee = collider;
++collidee;
for(PhysicsObjectList::iterator end = objects.end(); collidee != end; ++collidee)
{
if(IsCollide(**collider, **collidee))
{
#error commenting out code below stops segfaults
(*collider)->CollisionHandler(*collidee);
(*collidee)->CollisionHandler(*collider);
}
}
}
}
WorldObject:
class WorldObject
{
public:
Point location;
size_t height, width;
virtual ~WorldObject();
virtual ObjectType GetObjectType() const = 0;
virtual void CollisionHandler(const WorldObject* colidee) = 0;
};
Hmm.. the code doesn't seem to be displaying properly.