Hi all,I have been trying to track down a problem in my code where a timer is being triggered after a call to:
ev_timer_stop(msg->c->s->e->loop, &msg->timer.timer);
The ev_timer_stop is being called when the timer is being cleaned up,
however the timer is somehow remaining active, and gets called again a
little bit later, causing a crash as the underlying structure msg has
been freed.
I have noticed that at the point at which ev_timer_stop is run, the active counter is reset to zero, and the timer structure looks like this:
44 ev_timer_stop(msg->c->s->e->loop, &msg->timer.timer);
(gdb)
46 if (msg->c) {
(gdb) print msg->timer
$20 = {
timer = {
active = 0,
pending = 0,
priority = 0,
data = 0x0,
cb = 0x4e09 <watch_timed_message_cb>,
at = 3.9975130558013916,
repeat = 2
},
msg = 0x81a458
}
Further on, when the crash occurs, the active counter has jumped back up
to 3, and this timer has somehow become active again as follows:
(gdb) print w->msg->timer
$24 = {
timer = {
active = 3,
pending = 0,
priority = 0,
data = 0x0,
cb = 0x4e09 <watch_timed_message_cb>,
at = 1229358265.3815961,
repeat = 2
},
msg = 0x81a458
}
Can someone confirm first of all for me that ev_timer_stop is the
correct way to cancel a timer?
The docs make no mention of how you destroy a timer, only how you might create one or reset one.
Regards, Graham --
smime.p7s
Description: S/MIME Cryptographic Signature
_______________________________________________ libev mailing list [email protected] http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev
