I just now experimented with introducing one of the above changes and I immediately see warning from gcc.
base/timerQueueFix/src/libCom/timer/timer.cpp: In member function ‘virtual void Timer::destroy()’:
base/timerQueueFix/src/libCom/timer/timer.cpp:42:12: warning: deleting object of polymorphic class type ‘Timer’ which has non-virtual destructor might cause undefined behaviour [-Wdelete-non-virtual-dtor]
delete this;
> gcc --version
gcc (SUSE Linux) 4.8.5
So I am not well convinced that this is a good idea. Our only cost for the pure virtual DTOR is a small increase in the VTBL size which is probably insignificant.
I just now experimented with introducing one of the above changes and I immediately see warning from gcc.
base/timerQueue Fix/src/ libCom/ timer/timer. cpp: In member function ‘virtual void Timer::destroy()’: Fix/src/ libCom/ timer/timer. cpp:42: 12: warning: deleting object of polymorphic class type ‘Timer’ which has non-virtual destructor might cause undefined behaviour [-Wdelete- non-virtual- dtor]
base/timerQueue
delete this;
> gcc --version
gcc (SUSE Linux) 4.8.5
So I am not well convinced that this is a good idea. Our only cost for the pure virtual DTOR is a small increase in the VTBL size which is probably insignificant.