streamdev-cvs bugs & fixes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

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

Cheers,

Udo



[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux