$w->cb(undef) causes segfaults. (+patch)
[email protected] (Damien Neil)
| Newsgroups | perl.loop |
|---|---|
| Message-ID | <[email protected]> |
(Does this mailing list exist? My mail to [email protected] and [email protected] doesn't return. Perhaps mail on perl.org is just slow.) The following program segfaults after one second (when the watcher triggers): use Event; my $w = Event->timer(after => 1, cb => sub {}); $w->cb(undef); Event::loop; The problem is that watchers are not stopped when their callback is removed. I am attaching a patch which appears to fix the problem. - Damien
event.patch
(text/plain, 395 B)
*** Event-0.81-orig/c/watcher.c Tue Jun 13 08:24:24 2000
--- Event-0.81/c/watcher.c Wed May 30 10:22:59 2001
***************
*** 90,95 ****
--- 90,96 ----
WaPERLCB_off(ev);
ev->callback = 0;
ev->ext_data = 0;
+ pe_watcher_stop(ev, 0);
} else if (SvROK(nval) && (SvTYPE(sv=SvRV(nval)) == SVt_PVCV)) {
WaPERLCB_on(ev);
ev->callback = SvREFCNT_inc(nval);