[vdr] streamdev-cvs bugs & fixes

Stefan Lucke stefan at lucke.in-berlin.de
Sun Mar 6 18:32:10 CET 2005


On Sonntag, 6. März 2005 17:37, Udo Richter wrote:
> 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() 
> gets called.

That's exact that was I've seen when I run vdr from gdb. The line
reported was line 103 from streamer.c : Detach ().

> 
> Virtuals in destructors are dangerous. Better make sure the thread is 
> stopped before the object destructs...


-- 
Stefan Lucke




More information about the vdr mailing list