Commit e9641beb authored by George Zagaris's avatar George Zagaris
Browse files

BUGFIX: Fix memory leak in RequestInformation

The code was creating a new instance of vtkOverlappingAMR everytime
RequestInformation was called which would then ShallowCopy() the
metadata coming from upstream. This could lead to creation of multiple
instance of vtkOverlappingAMR that are not properly deallocated and
hence lead to leaks. Instead, the code does not allocate a new instance
but, simply updates the point to point to the metadata object coming from
upstream.

Change-Id: I244a4e3c9c57237fa99042d9bc11f229a8aa9d5c
parent c3b6eb24
......@@ -81,11 +81,11 @@ vtkAMRResampleFilter::~vtkAMRResampleFilter()
}
this->ROI = NULL;
if( this->AMRMetaData != NULL )
{
this->AMRMetaData->Delete();
}
this->AMRMetaData = NULL;
// if( this->AMRMetaData != NULL )
// {
// this->AMRMetaData->Delete();
// }
// this->AMRMetaData = NULL;
}
//-----------------------------------------------------------------------------
......@@ -150,10 +150,10 @@ int vtkAMRResampleFilter::RequestInformation(
if( this->DemandDrivenMode == 1 &&
input->Has(vtkCompositeDataPipeline::COMPOSITE_DATA_META_DATA() ) )
{
this->AMRMetaData = vtkOverlappingAMR::New();
this->AMRMetaData->ShallowCopy(
// this->AMRMetaData = vtkOverlappingAMR::New();
this->AMRMetaData =
vtkOverlappingAMR::SafeDownCast(
input->Get( vtkCompositeDataPipeline::COMPOSITE_DATA_META_DATA() ) ) );
input->Get( vtkCompositeDataPipeline::COMPOSITE_DATA_META_DATA() ) );
// Get Region
......@@ -165,6 +165,8 @@ int vtkAMRResampleFilter::RequestInformation(
this->ComputeAMRBlocksToLoad( this->AMRMetaData );
}
// Don't we need to call this->Modified() here?
// this->Modified();
return 1;
}
......
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