From dcf5dee8940733501d86a3af1fc7c51c7bb8de7a Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 14 Dec 2012 13:40:14 +0000 Subject: [PATCH] 21948: EDF SMESH : Memory is not freed when deleting a mesh Delete fields in order of their declaration in the header - for easier check --- src/OBJECT/SMESH_CellLabelActor.cxx | 23 +++++++++++------------ src/OBJECT/SMESH_CellLabelActor.h | 6 +++--- src/OBJECT/SMESH_DeviceActor.cxx | 26 +++++++++++--------------- 3 files changed, 25 insertions(+), 30 deletions(-) diff --git a/src/OBJECT/SMESH_CellLabelActor.cxx b/src/OBJECT/SMESH_CellLabelActor.cxx index 3e117de16..81f2107f0 100644 --- a/src/OBJECT/SMESH_CellLabelActor.cxx +++ b/src/OBJECT/SMESH_CellLabelActor.cxx @@ -91,7 +91,7 @@ SMESH_CellLabelActor::SMESH_CellLabelActor() { callBackCommand->SetCallback(SMESH_CellLabelActor::ProcessEvents); myTransformFilter->AddObserver("VTKViewer_TransformFilter::TransformationFinished", - callBackCommand); + callBackCommand); callBackCommand->Delete(); } @@ -103,23 +103,22 @@ SMESH_CellLabelActor::~SMESH_CellLabelActor() { //Deleting of cells numbering pipeline //--------------------------------------- myCellsNumDataSet->Delete(); + myCellsLabels->Delete(); + // commented: porting to vtk 5.0 + // myClsMaskPoints->UnRegisterAllOutputs(); + myClsMaskPoints->Delete(); + // commented: porting to vtk 5.0 + // myCellCenters->UnRegisterAllOutputs(); + myCellCenters->Delete(); myClsLabeledDataMapper->RemoveAllInputs(); myClsLabeledDataMapper->Delete(); - // commented: porting to vtk 5.0 // myClsSelectVisiblePoints->UnRegisterAllOutputs(); myClsSelectVisiblePoints->Delete(); - // commented: porting to vtk 5.0 - // myClsMaskPoints->UnRegisterAllOutputs(); - myClsMaskPoints->Delete(); - // commented: porting to vtk 5.0 - // myCellCenters->UnRegisterAllOutputs(); - myCellCenters->Delete(); - myCellsLabels->Delete(); } @@ -176,9 +175,9 @@ void SMESH_CellLabelActor::UpdateLabels() { void SMESH_CellLabelActor::ProcessEvents(vtkObject* vtkNotUsed(theObject), - unsigned long theEvent, - void* theClientData, - void* vtkNotUsed(theCallData)) { + unsigned long theEvent, + void* theClientData, + void* vtkNotUsed(theCallData)) { SMESH_CellLabelActor* self = reinterpret_cast(theClientData); if(self) self->UpdateLabels(); diff --git a/src/OBJECT/SMESH_CellLabelActor.h b/src/OBJECT/SMESH_CellLabelActor.h index 988a0dcaf..a754d0b08 100644 --- a/src/OBJECT/SMESH_CellLabelActor.h +++ b/src/OBJECT/SMESH_CellLabelActor.h @@ -42,9 +42,9 @@ public: static SMESH_CellLabelActor* New(); static void ProcessEvents(vtkObject* theObject, - unsigned long theEvent, - void* theClientData, - void* theCallData); + unsigned long theEvent, + void* theClientData, + void* theCallData); vtkTypeMacro(SMESH_CellLabelActor, SMESH_DeviceActor); diff --git a/src/OBJECT/SMESH_DeviceActor.cxx b/src/OBJECT/SMESH_DeviceActor.cxx index d53765d79..c82bbf305 100644 --- a/src/OBJECT/SMESH_DeviceActor.cxx +++ b/src/OBJECT/SMESH_DeviceActor.cxx @@ -138,33 +138,29 @@ SMESH_DeviceActor { if(MYDEBUG) MESSAGE("~SMESH_DeviceActor - "<Delete(); - myMapper->Delete(); - myShrinkFilter->Delete(); + myProperty->Delete(); - myExtractUnstructuredGrid->Delete(); + myExtractGeometry->Delete(); myMergeFilter->Delete(); + myExtractUnstructuredGrid->Delete(); - myGeomFilter->Delete(); + // Orientation of faces + myFaceOrientationFilter->Delete(); + myFaceOrientationDataMapper->RemoveAllInputs(); + myFaceOrientationDataMapper->Delete(); + myFaceOrientation->Delete(); - myExtractGeometry->Delete(); + myGeomFilter->Delete(); myTransformFilter->Delete(); - for(int i = 0, iEnd = myPassFilter.size(); i < iEnd; i++){ + for(int i = 0, iEnd = myPassFilter.size(); i < iEnd; i++) myPassFilter[i]->Delete(); - } - - // Orientation of faces - myFaceOrientationFilter->Delete(); - - myFaceOrientationDataMapper->RemoveAllInputs(); - myFaceOrientationDataMapper->Delete(); - myFaceOrientation->Delete(); + myShrinkFilter->Delete(); } -- 2.39.2