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),