MantisBT - VTK
View Issue Details
0013224VTK(No Category)public2012-06-06 20:432013-10-22 15:30
dennisHu 
Dan Lipsa 
lowminorhave not tried
closedwon't fix 
 
 
TBD
incorrect functionality
0013224: vtkInteractorObserver destructor calls virtual function SetEnabled
virtual function SetEnabled is called in the destructor of vtkInteractorObserver.
From debug, it just calls empty function in vtkInteractorObserver.

As we know, from http://www.artima.com/cppsource/nevercall.html [^]
Never call virtual functions during construction or destruction.

It's better to remove this call.
I guess SetEnabled(0) will be called in sub-class destructor.
Indeed, it is not the best style to call virtual functions in constructors/destructors as this might suggest that you want derived behavior to be invoked. The C++ standard does specify that the function that is called in this case is the function defined in the current class (the function does not depend on the object the function is called through). It is as if the functions called do not have the virtual keyword.

There are four virtual functions called in the destructor: SetEnabled, SetCurrentRenderer, SetDefaultRenderer and SetInteractor, some are non-empty.

Removing calls to the virtual functions in the destructor might require researching/changing vtkInteractorObserver and tens of derived classes.
No tags attached.
Issue History
2012-06-06 20:43dennisHuNew Issue
2013-10-21 13:40Dan LipsaAssigned To => Dan Lipsa
2013-10-21 13:40Dan LipsaStatusbacklog => tabled
2013-10-21 14:18Dave DeMarleStatustabled => backlog
2013-10-22 13:28Dan LipsaStatusbacklog => closed
2013-10-22 13:28Dan LipsaResolutionopen => won't fix
2013-10-22 13:28Dan LipsaAdditional Information Updatedbug_revision_view_page.php?rev_id=659#r659
2013-10-22 15:25Dan LipsaStatusclosed => backlog
2013-10-22 15:25Dan LipsaResolutionwon't fix => reopened
2013-10-22 15:30Dan LipsaStatusbacklog => closed
2013-10-22 15:30Dan LipsaResolutionreopened => won't fix
2013-10-22 15:30Dan LipsaAdditional Information Updatedbug_revision_view_page.php?rev_id=660#r660

There are no notes attached to this issue.