[zeromq-dev] pure virtual method called
Martin Sustrik
sustrik at 250bpm.com
Sat Oct 16 00:32:32 CEST 2010
Hi Toralf,
> pgm_sender_t::unplug() cancels timers only if the corresponding
> has_rx_timer or has_tx_timer flags have been set. So what may happen
> is that even after unplug() there may still be timers registered at
> poller_base_t. And since pgm_sender_t::terminate() calls "delete
> this" after unplug(), behaviour is undefined if
> pgm_sender_t::timer_event(int token) is invoked again. (Here it seems
> that the pure virtual base class methods are invoked instead. Could as
> well be a segmentation fault I guess.).
Yes. That's the case.
> Likely this happens because in
> void zmq::pgm_sender_t::out_event() rx_timer_id is reset. I think it
> should be tx_timer_id instead, or?
>
Good spot! Can you please sign off the patch so that I can apply it?
http://www.zeromq.org/docs:contributing#toc6
However, while the above is definitely a bug, I don't think it can
actually cause the pure virtual method to be called. Or am I missing
something.
I would rather say the problem is caused by deleting the pgm_sender_t
object without calling unplug beforehand.
Martin
More information about the zeromq-dev
mailing list