[vdr] streamdev-cvs bugs & fixes
udo_richter at gmx.de
Sun Mar 6 17:37:01 CET 2005
Sascha Volkenandt wrote:
> I assume this is a compiler bug, since the error should be caught at
> compile-time (I can't see any error though, since the called object is a
> derivation and the method is derived, too). Anyway, if I "shift around" those
> methods a bit, it throws a "pure virtual method" error with gcc 2.95, but not
> with gcc 3.x.
I've seen pure virtual method errors before with cThread's. There is a
way how these pure virtuals can get active: At destructor time, as soon
as the derived class is destructed, the virtuals get reverted to the
pure virtuals of the base class, before the base class destructor takes
over. Reason is that the derived object is gone as soon as the derived
destructor ends, and only the base object needs to destruct.
In this case (just a guess by a quick look at source code):
~cStreamdevStreamer() calls Stop(), and Stop() calls Detach(). Since the
derived cStreamdevLiveStreamer is already destructed, its virtual
Detach() is gone too, and the pure virtual cStreamdevStreamer::Detach()
Virtuals in destructors are dangerous. Better make sure the thread is
stopped before the object destructs...
More information about the vdr