fixed more memory leaks

This commit is contained in:
zzzzrrr 2010-04-23 11:51:22 -04:00
parent 15db727895
commit 75f8496e22
2 changed files with 12 additions and 4 deletions

View File

@ -88,7 +88,7 @@ Node& Sweep::PointEvent(SweepContext& tcx, Point& point)
// x value than node due to how we fetch nodes from the front
if (point.x <= node.point->x + EPSILON) {
Fill(tcx, node);
tcx.RemoveNode(&node);
delete &node;
}
//tcx.AddNode(new_node);
@ -535,19 +535,27 @@ void Sweep::FillBasinReq(SweepContext& tcx, Node* node)
if (o == CW) {
return;
}
Node *temp = node;
node = node->next;
delete temp;
} else if (node->next == tcx.basin.right_node) {
Orientation o = Orient2d(*node->point, *node->prev->point, *node->prev->prev->point);
if (o == CCW) {
return;
}
Node *temp = node;
node = node->prev;
delete temp;
} else {
// Continue with the neighbor node with lowest Y value
if (node->prev->point->y < node->next->point->y) {
Node *temp = node;
node = node->prev;
delete temp;
} else {
Node *temp = node;
node = node->next;
delete temp;
}
}
@ -700,8 +708,9 @@ void Sweep::FillLeftConcaveEdgeEvent(SweepContext& tcx, Edge* edge, Node& node)
} else{
// Next is convex
}
}
}
}
}
}
void Sweep::FlipEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle* t, Point& p)

View File

@ -130,7 +130,6 @@ void SweepContext::CreateAdvancingFront()
head = new Node(*triangle->GetPoint(1), *triangle);
middle = new Node(*triangle->GetPoint(0), *triangle);
tail = new Node(*triangle->GetPoint(2));
front_ = new AdvancingFront(*head, *tail);
// TODO: More intuitive if head is middles next and not previous?