From 9c1c3b2a6def6a7ee512919c105ceea8939e7f66 Mon Sep 17 00:00:00 2001 From: srit Date: Mon, 28 Mar 2011 13:51:00 +0000 Subject: [PATCH] Use smart pointers for vvSlicers --- vv/vvSlicerManager.cxx | 17 +++-------------- vv/vvSlicerManager.h | 2 +- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/vv/vvSlicerManager.cxx b/vv/vvSlicerManager.cxx index 8a68f28..1daee2c 100644 --- a/vv/vvSlicerManager.cxx +++ b/vv/vvSlicerManager.cxx @@ -60,19 +60,12 @@ vvSlicerManager::vvSlicerManager(int numberOfSlicers) mFusionWindow = 1000; mFusionLevel = 1000; - mReader = NULL; - mImage = NULL; - mVF=NULL; - mVectorReader = NULL; - mOverlayReader = NULL; - mFusionReader = NULL; mLandmarks = NULL; mLinkedId.resize(0); - for ( int i = 0; i < numberOfSlicers; i++) { - vvSlicer *slicer = vvSlicer::New(); - mSlicers.push_back(slicer); - } + for ( int i = 0; i < numberOfSlicers; i++) + mSlicers.push_back(vtkSmartPointer::New()); + mPreviousSlice.resize(numberOfSlicers); mPreviousTSlice.resize(numberOfSlicers); } @@ -82,10 +75,6 @@ vvSlicerManager::vvSlicerManager(int numberOfSlicers) //---------------------------------------------------------------------------- vvSlicerManager::~vvSlicerManager() { - for ( unsigned int i = 0; i < mSlicers.size(); i++) { - if (mSlicers[i] != NULL) - mSlicers[i]->Delete(); - } if (mLandmarks) delete mLandmarks; } diff --git a/vv/vvSlicerManager.h b/vv/vvSlicerManager.h index 10e9c9d..ea079c4 100644 --- a/vv/vvSlicerManager.h +++ b/vv/vvSlicerManager.h @@ -214,7 +214,7 @@ signals : void AVerticalSliderHasChanged(int slicer, int slice); protected: - std::vector mSlicers; + std::vector< vtkSmartPointer > mSlicers; vvImageReader::Pointer mReader; vvImageReader::Pointer mOverlayReader; vvImageReader::Pointer mFusionReader; -- 2.47.1