Commit 9b46579d authored by David Gobbi's avatar David Gobbi
Browse files

Perform explicit list deletion in CCSEdgeLocator.

The vtkClipClosedSurface helper class vtkEdgeLocatorNode would
delete the whole node list in its destructor.  This is a bad
idea, because because if the implicit copy constructor is called
on a node, and the copy destructs, then the list will partially
destruct.  Add a FreeList() method that is called explicitly when
the list is to be freed.

Change-Id: I8945dc1682b6a70f66561b1f4155ed22be6fb0d6
parent 313d19c3
......@@ -196,7 +196,7 @@ public:
vtkCCSEdgeLocatorNode() :
ptId0(-1), ptId1(-1), edgeId(-1), next(0) {};
~vtkCCSEdgeLocatorNode() {
void FreeList() {
vtkCCSEdgeLocatorNode *ptr = this->next;
while (ptr)
{
......@@ -225,6 +225,7 @@ public:
return new vtkCCSEdgeLocator; };
void Delete() {
this->Initialize();
delete this; };
// Description:
......@@ -241,6 +242,12 @@ public:
void vtkCCSEdgeLocator::Initialize()
{
for (MapType::iterator i = this->EdgeMap.begin();
i != this->EdgeMap.end();
++i)
{
i->second.FreeList();
}
this->EdgeMap.clear();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment