View Issue Details [ Jump to Notes ] | [ Print ] |
ID | Project | Category | View Status | Date Submitted | Last Update |
0013224 | VTK | (No Category) | public | 2012-06-06 20:43 | 2013-10-22 15:30 |
|
Reporter | dennisHu | |
Assigned To | Dan Lipsa | |
Priority | low | Severity | minor | Reproducibility | have not tried |
Status | closed | Resolution | won't fix | |
Platform | | OS | | OS Version | |
Product Version | | |
Target Version | | Fixed in Version | | |
|
Summary | 0013224: vtkInteractorObserver destructor calls virtual function SetEnabled |
Description | 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. |
Additional Information | 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.
|
Tags | No tags attached. |
|
Project | TBD |
Type | incorrect functionality |
|
Attached Files | |
|