HEMeshFaceBodyC::~HEMeshFaceBodyC()
deletes the edges that form the face and calls
HEMeshEdgeBodyC::CorrectVertexEdgePtr()
to fix the edge referenced by the vertex so that it does
not reference a deleted edge
BUT
when you delete the last edge for the face,
CorrectVertexEdgePtr can fail
in CorrectVertexEdgePtr you do:
HEMeshEdgeBodyC *newEdge = Next()->pair;
if( newEdge != 0 )
{
vertex->edge = newEdge;
return;
}
the problem is that when you get to the last edge on
the face Next() is actually the same as the edge so
newEdge = this->pair.
modify something like this:
if( newEdge != 0 )
{
if (Next() == this)
{
vertex->edge = &newEdge->Prev();
}
else
{
vertex->edge = newEdge;
}
return ;
}