--- EV/EV.xs 2007/11/01 11:55:54 1.33 +++ EV/EV.xs 2007/11/01 12:11:07 1.34 @@ -85,6 +85,15 @@ return (void *)w; } +static void * +e_destroy (void *w_) +{ + struct ev_watcher *w = w_; + + SvREFCNT_dec (w->fh ); w->fh = 0; + SvREFCNT_dec (w->cb_sv); w->cb_sv = 0; +} + static SV * e_bless (struct ev_watcher *w, HV *stash) { @@ -440,6 +449,7 @@ void DESTROY (struct ev_io *w) CODE: ev_io_stop (w); + e_destroy (w); void set (struct ev_io *w, SV *fh, int events) CODE: @@ -502,6 +512,7 @@ void DESTROY (struct ev_signal *w) CODE: ev_signal_stop (w); + e_destroy (w); void set (struct ev_signal *w, SV *signal = 0) CODE: @@ -531,6 +542,7 @@ void DESTROY (struct ev_timer *w) CODE: ev_timer_stop (w); + e_destroy (w); void set (struct ev_timer *w, NV after, NV repeat = 0.) INIT: @@ -554,6 +566,7 @@ void DESTROY (struct ev_periodic *w) CODE: ev_periodic_stop (w); + e_destroy (w); void set (struct ev_periodic *w, NV at, NV interval = 0.) INIT: @@ -575,6 +588,7 @@ void DESTROY (struct ev_idle *w) CODE: ev_idle_stop (w); + e_destroy (w); MODULE = EV PACKAGE = EV::Prepare PREFIX = ev_check_ @@ -585,6 +599,7 @@ void DESTROY (struct ev_prepare *w) CODE: ev_prepare_stop (w); + e_destroy (w); MODULE = EV PACKAGE = EV::Check PREFIX = ev_check_ @@ -595,6 +610,7 @@ void DESTROY (struct ev_check *w) CODE: ev_check_stop (w); + e_destroy (w); MODULE = EV PACKAGE = EV::Child PREFIX = ev_child_ @@ -605,6 +621,7 @@ void DESTROY (struct ev_child *w) CODE: ev_child_stop (w); + e_destroy (w); void set (struct ev_child *w, int pid) CODE: