From 7e13ab2906ddded92c68e93655723b9b02de90aa Mon Sep 17 00:00:00 2001 From: apo Date: Wed, 7 Dec 2005 12:12:11 +0000 Subject: [PATCH] To improve VTK connection management --- src/VVTK/VVTK_SegmentationCursorDlg.cxx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/VVTK/VVTK_SegmentationCursorDlg.cxx b/src/VVTK/VVTK_SegmentationCursorDlg.cxx index 1a62c496..d2eaa17e 100644 --- a/src/VVTK/VVTK_SegmentationCursorDlg.cxx +++ b/src/VVTK/VVTK_SegmentationCursorDlg.cxx @@ -352,15 +352,23 @@ VVTK_SegmentationCursorDlg::VVTK_SegmentationCursorDlg( QWidget* parent, const c VVTK_SegmentationCursorDlg::~VVTK_SegmentationCursorDlg() { + SetWidgetCtrl(NULL); } void VVTK_SegmentationCursorDlg::SetWidgetCtrl( VISU_WidgetCtrl* theWidgetCtrl ) { + if(myWidgetCtrl == theWidgetCtrl) + return; + + if(myWidgetCtrl) + myWidgetCtrl->RemoveObserver(myEventCallbackCommand.GetPointer()); + myWidgetCtrl = theWidgetCtrl; - myWidgetCtrl->AddObserver(vtkCommand::EndInteractionEvent, - myEventCallbackCommand.GetPointer(), - myPriority); + if(theWidgetCtrl) + theWidgetCtrl->AddObserver(vtkCommand::EndInteractionEvent, + myEventCallbackCommand.GetPointer(), + myPriority); } void VVTK_SegmentationCursorDlg::ProcessEvents(vtkObject* vtkNotUsed(theObject), -- 2.39.2