From cbe5a471e16307e956e4cf5653a61cd5d83c4ee3 Mon Sep 17 00:00:00 2001 From: tbaudier Date: Fri, 2 Dec 2016 10:24:13 +0100 Subject: [PATCH] Debug Profile tool cancel A segmentation fault occured after a click on Cancel during image selection --- vv/vvToolProfile.cxx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/vv/vvToolProfile.cxx b/vv/vvToolProfile.cxx index 4360fee..6ebe144 100644 --- a/vv/vvToolProfile.cxx +++ b/vv/vvToolProfile.cxx @@ -361,18 +361,19 @@ void vvToolProfile::cancelPoints() //------------------------------------------------------------------------------ void vvToolProfile::RemoveVTKObjects() { - for(int i=0;iGetNumberOfSlicers(); i++) { - mCurrentSlicerManager->GetSlicer(i)->GetRenderer()->RemoveActor(mLineActors[i]); - } + if (mCurrentSlicerManager) + { + for(int i=0;iGetNumberOfSlicers(); i++) { + mCurrentSlicerManager->GetSlicer(i)->GetRenderer()->RemoveActor(mLineActors[i]); + } - if (mPoint1Selected) - mCurrentSlicerManager->GetLandmarks()->RemoveLandmarkWithLabel("P1", mPoint1[3]); - if (mPoint2Selected) - mCurrentSlicerManager->GetLandmarks()->RemoveLandmarkWithLabel("P2", mPoint2[3]); + if (mPoint1Selected) + mCurrentSlicerManager->GetLandmarks()->RemoveLandmarkWithLabel("P1", mPoint1[3]); + if (mPoint2Selected) + mCurrentSlicerManager->GetLandmarks()->RemoveLandmarkWithLabel("P2", mPoint2[3]); - - if (mCurrentSlicerManager) mCurrentSlicerManager->Render(); + } } //------------------------------------------------------------------------------ -- 2.47.1