Commit 053fb96b authored by loring's avatar loring
Browse files

re apply r23178 fix for memory leak but only decrement

ref count if data was new'ed.



git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@23183 18c085ea-50e0-402c-830e-de6fd14e8384
parent c114a8ee
...@@ -152,6 +152,9 @@ avtCondenseDatasetFilter::~avtCondenseDatasetFilter() ...@@ -152,6 +152,9 @@ avtCondenseDatasetFilter::~avtCondenseDatasetFilter()
// Changed function to be thread safe. I remove the class variable rpfPD // Changed function to be thread safe. I remove the class variable rpfPD
// and rpfUG. Now I allocate the needed VTK object during execution. // and rpfUG. Now I allocate the needed VTK object during execution.
// //
// Burlen Loring, Mon Apr 14 15:56:19 PDT 2014
// Don't take two references to the output
//
// **************************************************************************** // ****************************************************************************
vtkDataSet * vtkDataSet *
...@@ -168,7 +171,7 @@ avtCondenseDatasetFilter::ExecuteData(vtkDataSet *in_ds, int, std::string) ...@@ -168,7 +171,7 @@ avtCondenseDatasetFilter::ExecuteData(vtkDataSet *in_ds, int, std::string)
// copies of the data can really slow things down. // copies of the data can really slow things down.
// //
vtkDataSet *no_vars = in_ds; vtkDataSet *no_vars = in_ds;
bool needToDelete = false; bool needToDeleteNoVars = false;
bool needToRemoveAVar = true; bool needToRemoveAVar = true;
for (int j = 0 ; (j < 2) && needToRemoveAVar ; j++) for (int j = 0 ; (j < 2) && needToRemoveAVar ; j++)
{ {
...@@ -181,7 +184,7 @@ avtCondenseDatasetFilter::ExecuteData(vtkDataSet *in_ds, int, std::string) ...@@ -181,7 +184,7 @@ avtCondenseDatasetFilter::ExecuteData(vtkDataSet *in_ds, int, std::string)
// the arrays. // the arrays.
no_vars = (vtkDataSet *) in_ds->NewInstance(); no_vars = (vtkDataSet *) in_ds->NewInstance();
no_vars->ShallowCopy(in_ds); no_vars->ShallowCopy(in_ds);
needToDelete = true; needToDeleteNoVars = true;
} }
if (!keepAVTandVTK) if (!keepAVTandVTK)
...@@ -292,6 +295,7 @@ avtCondenseDatasetFilter::ExecuteData(vtkDataSet *in_ds, int, std::string) ...@@ -292,6 +295,7 @@ avtCondenseDatasetFilter::ExecuteData(vtkDataSet *in_ds, int, std::string)
} }
vtkDataSet *out_ds = NULL; vtkDataSet *out_ds = NULL;
bool needToDeleteOutDs = false;
if (shouldTakeRelevantPoints) if (shouldTakeRelevantPoints)
{ {
vtkPolyData *out_pd = NULL; vtkPolyData *out_pd = NULL;
...@@ -314,6 +318,7 @@ avtCondenseDatasetFilter::ExecuteData(vtkDataSet *in_ds, int, std::string) ...@@ -314,6 +318,7 @@ avtCondenseDatasetFilter::ExecuteData(vtkDataSet *in_ds, int, std::string)
rpfPD->Update(); rpfPD->Update();
rpfPD->Delete(); rpfPD->Delete();
out_ds = (vtkDataSet*)out_pd; out_ds = (vtkDataSet*)out_pd;
needToDeleteOutDs = true;
break; break;
} }
...@@ -326,6 +331,7 @@ avtCondenseDatasetFilter::ExecuteData(vtkDataSet *in_ds, int, std::string) ...@@ -326,6 +331,7 @@ avtCondenseDatasetFilter::ExecuteData(vtkDataSet *in_ds, int, std::string)
rpfUG->Update(); rpfUG->Update();
rpfUG->Delete(); rpfUG->Delete();
out_ds = (vtkDataSet*)out_ug; out_ds = (vtkDataSet*)out_ug;
needToDeleteOutDs = true;
break; break;
} }
...@@ -344,7 +350,11 @@ avtCondenseDatasetFilter::ExecuteData(vtkDataSet *in_ds, int, std::string) ...@@ -344,7 +350,11 @@ avtCondenseDatasetFilter::ExecuteData(vtkDataSet *in_ds, int, std::string)
if (out_ds != in_ds) if (out_ds != in_ds)
ManageMemory(out_ds); ManageMemory(out_ds);
if (needToDelete)
if (needToDeleteOutDs)
out_ds->Delete();
if (needToDeleteNoVars)
no_vars->Delete(); no_vars->Delete();
return out_ds; return out_ds;
......
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