Reinhard Nissl wrote:
I've just got a pure virtual function call in cDevice::Action() for
receiver[i]->Receive(b, TS_SIZE);
cReceiver::~cReceiver() calls Detach(), but at that time, it is simply
too late as the virtual method table entry for Receive() has already
been restored to 0.
I suggest to call Detach() from cFemonReceiver::~cFemonReceiver() to fix
this issue.
Calling virtual functions from destructors is generally not a good idea.
It works if the call is in the deepest nested destructor, but within a
base class destructor, virtual functions are already being destructed
and reverted to the base class. (here: to a pure virtual dummy)
The best method to avoid this is to do all cleanup involving virtual
functions before destroying the object. If this is not possible, it also
works to do the cleanup in EVERY derived class' destructor.
This is extremely nasty within a cThread, where you have to make sure
that the thread got stopped _before_ the destructor gets called, or you
risk to 'steal' the virtual functions from the running thread.
Cheers,
Udo
_______________________________________________
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr