]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To improve VTK connection management
authorapo <apo@opencascade.com>
Wed, 7 Dec 2005 12:12:11 +0000 (12:12 +0000)
committerapo <apo@opencascade.com>
Wed, 7 Dec 2005 12:12:11 +0000 (12:12 +0000)
src/VVTK/VVTK_SegmentationCursorDlg.cxx

index 1a62c4964fb08fbe26218f48ac925a99342e1f61..d2eaa17e556ebcb875fca3b5e2b9254d240bbf39 100644 (file)
@@ -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),