Commit b882736a authored by Ken Martin's avatar Ken Martin

Fix a couple leaks in the compositeLICMapper

It was leaking graphics resources and its output. Had to add
in a ReportReference call to report the use of its helper.
parent 47425ee6
......@@ -21,6 +21,7 @@
#include "vtkCompositeDataPipeline.h"
#include "vtkCompositeDataSet.h"
#include "vtkCompositeDataDisplayAttributes.h"
#include "vtkGarbageCollector.h"
#include "vtkHardwareSelector.h"
#include "vtkInformation.h"
#include "vtkMath.h"
......@@ -104,7 +105,12 @@ vtkCompositeSurfaceLICMapper::~vtkCompositeSurfaceLICMapper()
this->Helpers.begin();
for (;miter != this->Helpers.end(); miter++)
{
miter->second->Delete();
if (miter->second)
{
vtkObjectBase *obj = miter->second;
miter->second = 0;
obj->UnRegister(this);
}
}
this->Helpers.clear();
}
......@@ -551,3 +557,28 @@ void vtkCompositeSurfaceLICMapper::Render(vtkRenderer *ren, vtkActor *actor)
this->UpdateProgress(1.0);
}
//-----------------------------------------------------------------------------
void vtkCompositeSurfaceLICMapper::ReleaseGraphicsResources(vtkWindow* win)
{
std::map<const vtkDataSet*, vtkCompositeLICHelper *>::iterator miter =
this->Helpers.begin();
for (;miter != this->Helpers.end(); miter++)
{
miter->second->ReleaseGraphicsResources(win);
}
this->Superclass::ReleaseGraphicsResources(win);
}
//-----------------------------------------------------------------------------
void vtkCompositeSurfaceLICMapper::ReportReferences(vtkGarbageCollector *collector)
{
this->Superclass::ReportReferences(collector);
std::map<const vtkDataSet*, vtkCompositeLICHelper *>::iterator miter =
this->Helpers.begin();
for (;miter != this->Helpers.end(); miter++)
{
vtkGarbageCollectorReport(collector, miter->second, "Helper Mapper");
}
}
......@@ -46,6 +46,12 @@ public:
// This calls RenderPiece (in a for loop if streaming is necessary).
virtual void Render(vtkRenderer *ren, vtkActor *act);
// Description:
// Release any graphics resources that are being consumed by this mapper.
// The parameter window could be used to determine which graphic
// resources to release. In this case, releases the display lists.
virtual void ReleaseGraphicsResources(vtkWindow * win);
// Description:
// Returns if the mapper does not expect to have translucent geometry. This
// may happen when using ScalarMode is set to not map scalars i.e. render the
......@@ -95,6 +101,10 @@ protected:
vtkCompositeSurfaceLICMapper();
~vtkCompositeSurfaceLICMapper();
// Description:
// Take part in garbage collection.
virtual void ReportReferences(vtkGarbageCollector *collector);
// Description:
// We need to override this method because the standard streaming
// demand driven pipeline is not what we want - we are expecting
......
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