From fbf6dbfffc6bbce02f107c9b28ff37662f3c0825 Mon Sep 17 00:00:00 2001 From: apo Date: Mon, 3 Oct 2005 06:19:30 +0000 Subject: [PATCH] To provide correct memory management --- src/VTKViewer/VTKViewer_Trihedron.cxx | 13 +++++++++++-- src/VTKViewer/VTKViewer_Trihedron.h | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/VTKViewer/VTKViewer_Trihedron.cxx b/src/VTKViewer/VTKViewer_Trihedron.cxx index 387bbf83e..9ff5e6946 100755 --- a/src/VTKViewer/VTKViewer_Trihedron.cxx +++ b/src/VTKViewer/VTKViewer_Trihedron.cxx @@ -139,8 +139,8 @@ VTKViewer_Axis::~VTKViewer_Axis() /*! \li Destroy of the Label pipe-line representation */ myLabelActor->Delete(); - myMapper[2]->RemoveAllInputs(); - myMapper[2]->Delete(); + myMapper[0]->RemoveAllInputs(); + myMapper[0]->Delete(); myVectorText->Delete(); @@ -168,6 +168,13 @@ void VTKViewer_Axis::AddToRender(vtkRenderer* theRenderer){ theRenderer->AddActor(myArrowActor); } +void VTKViewer_Axis::RemoveFromRender(vtkRenderer* theRenderer){ + /*! \li Order of the calls are important*/ + theRenderer->RemoveActor(myLineActor); + theRenderer->RemoveActor(myLabelActor); + theRenderer->RemoveActor(myArrowActor); +} + void VTKViewer_Axis::SetVisibility(VTKViewer_Trihedron::TVisibility theVis) { switch(theVis){ @@ -343,6 +350,8 @@ void VTKViewer_Trihedron::RemoveFromRender(vtkRenderer* theRenderer) myPresent->InitTraversal(); while(vtkActor* anActor = myPresent->GetNextActor()) theRenderer->RemoveActor(anActor); + for(int i = 0; i < 3; i++) + myAxis[i]->RemoveFromRender(theRenderer); } int VTKViewer_Trihedron::GetVisibleActorCount(vtkRenderer* theRenderer) diff --git a/src/VTKViewer/VTKViewer_Trihedron.h b/src/VTKViewer/VTKViewer_Trihedron.h index 9c3597ca5..74aebace8 100755 --- a/src/VTKViewer/VTKViewer_Trihedron.h +++ b/src/VTKViewer/VTKViewer_Trihedron.h @@ -186,6 +186,7 @@ public: /*! Add to \a theRenderer actors: myLineActor,myLabelActor,myArrowActor */ virtual void AddToRender(vtkRenderer* theRenderer); + virtual void RemoveFromRender(vtkRenderer* theRenderer); /*! Sets visibility for actors: myLineActor,myLabelActor,myArrowActor */ -- 2.39.2