From d94e3a0183d28c140a941a405e3c176826e131fc Mon Sep 17 00:00:00 2001 From: apo Date: Tue, 13 Sep 2005 04:13:59 +0000 Subject: [PATCH] To provide correct memory menagement So, all descendant of SVTK package should not do care about memory management. Only simple pointers should be stored (do not use any smart pointers). The VTK's RenderWindow/Renderer/RenderWindowInteractor/InteractorStyle classes have close conversation and should be destroyed in strict order. Therefore all the memory manemgemnt code was moved to corresponding basic classes. --- src/VVTK/VVTK_Renderer.h | 2 +- src/VVTK/VVTK_View.cxx | 6 +++--- src/VVTK/VVTK_View.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/VVTK/VVTK_Renderer.h b/src/VVTK/VVTK_Renderer.h index 19251827..bb6ff97a 100644 --- a/src/VVTK/VVTK_Renderer.h +++ b/src/VVTK/VVTK_Renderer.h @@ -102,8 +102,8 @@ class VVTK_EXPORT VVTK_Renderer2 : public SVTK_Renderer float myPriority; vtkSmartPointer myImplicitPlaneWidget1; - vtkSmartPointer myRenderer1; vtkSmartPointer myFunction; + VVTK_Renderer1* myRenderer1; }; diff --git a/src/VVTK/VVTK_View.cxx b/src/VVTK/VVTK_View.cxx index a38065d8..bab23772 100644 --- a/src/VVTK/VVTK_View.cxx +++ b/src/VVTK/VVTK_View.cxx @@ -147,7 +147,7 @@ VVTK_MainWindow1 ::Initialize() { myRenderer = VVTK_Renderer1::New(); - VVTK_MainWindowBase::Initialize(myRenderer.GetPointer()); + VVTK_MainWindowBase::Initialize(myRenderer); myRenderer->Delete(); } @@ -161,7 +161,7 @@ VVTK_Renderer1* VVTK_MainWindow1 ::GetRenderer1() { - return myRenderer.GetPointer(); + return myRenderer; } //---------------------------------------------------------------------------- @@ -202,7 +202,7 @@ VVTK_MainWindow2 ::Initialize() { myRenderer = VVTK_Renderer2::New(); - VVTK_MainWindowBase::Initialize(myRenderer.GetPointer()); + VVTK_MainWindowBase::Initialize(myRenderer); myRenderer->Delete(); myRenderer->SetRenderer1(myMainWindow->GetRenderer1()); diff --git a/src/VVTK/VVTK_View.h b/src/VVTK/VVTK_View.h index af8544ea..65987b95 100644 --- a/src/VVTK/VVTK_View.h +++ b/src/VVTK/VVTK_View.h @@ -64,7 +64,7 @@ public: void OnPlaneSegmentationSwitch(bool theIsPlaneSegmentationOn); protected: - vtkSmartPointer myRenderer; + VVTK_Renderer1* myRenderer; }; @@ -92,7 +92,7 @@ public: protected: VVTK_MainWindow1* myMainWindow; - vtkSmartPointer myRenderer; + VVTK_Renderer2* myRenderer; }; -- 2.39.2