From: apo Date: Wed, 7 Dec 2005 12:12:11 +0000 (+0000) Subject: To improve VTK connection management X-Git-Tag: TG-D5-38-2003_D2005-20-12~51 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7e13ab2906ddded92c68e93655723b9b02de90aa;p=modules%2Fvisu.git To improve VTK connection management --- 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),