]> Creatis software - clitk.git/commitdiff
Debug Profile tool cancel
authortbaudier <thomas.baudier@creatis.insa-lyon.fr>
Fri, 2 Dec 2016 09:24:13 +0000 (10:24 +0100)
committertbaudier <thomas.baudier@creatis.insa-lyon.fr>
Fri, 2 Dec 2016 09:24:13 +0000 (10:24 +0100)
A segmentation fault occured after a click on Cancel during image selection

vv/vvToolProfile.cxx

index 4360fee91119781a9401032d189fafed7065cdf6..6ebe1449703243b679570b0ff825115f589132d7 100644 (file)
@@ -361,18 +361,19 @@ void vvToolProfile::cancelPoints()
 //------------------------------------------------------------------------------
 void vvToolProfile::RemoveVTKObjects()
 { 
-  for(int i=0;i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
-    mCurrentSlicerManager->GetSlicer(i)->GetRenderer()->RemoveActor(mLineActors[i]);
-  }
+  if (mCurrentSlicerManager)
+  {
+    for(int i=0;i<mCurrentSlicerManager->GetNumberOfSlicers(); 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();
+  }
 }
 //------------------------------------------------------------------------------