| 12 static void |
12 static void |
| 13 destroy_timeout_handler(GaimPerlTimeoutHandler *handler) |
13 destroy_timeout_handler(GaimPerlTimeoutHandler *handler) |
| 14 { |
14 { |
| 15 timeout_handlers = g_list_remove(timeout_handlers, handler); |
15 timeout_handlers = g_list_remove(timeout_handlers, handler); |
| 16 |
16 |
| 17 g_free(handler->name); |
17 if (handler->callback != NULL) |
| |
18 SvREFCNT_dec(handler->callback); |
| |
19 |
| |
20 if (handler->data != NULL) |
| |
21 SvREFCNT_dec(handler->data); |
| |
22 |
| 18 g_free(handler); |
23 g_free(handler); |
| 19 } |
24 } |
| 20 |
25 |
| 21 static void |
26 static void |
| 22 destroy_signal_handler(GaimPerlSignalHandler *handler) |
27 destroy_signal_handler(GaimPerlSignalHandler *handler) |
| 23 { |
28 { |
| 24 signal_handlers = g_list_remove(signal_handlers, handler); |
29 signal_handlers = g_list_remove(signal_handlers, handler); |
| 25 |
|
| 26 if (handler->instance != NULL) |
|
| 27 SvREFCNT_dec(handler->instance); |
|
| 28 |
30 |
| 29 if (handler->callback != NULL) |
31 if (handler->callback != NULL) |
| 30 SvREFCNT_dec(handler->callback); |
32 SvREFCNT_dec(handler->callback); |
| 31 |
33 |
| 32 if (handler->data != NULL) |
34 if (handler->data != NULL) |
| 144 return; |
145 return; |
| 145 } |
146 } |
| 146 |
147 |
| 147 handler = g_new0(GaimPerlTimeoutHandler, 1); |
148 handler = g_new0(GaimPerlTimeoutHandler, 1); |
| 148 |
149 |
| 149 handler->plugin = plugin; |
150 handler->plugin = plugin; |
| 150 handler->name = g_strdup(func); |
151 handler->callback = (callback != NULL && callback != &PL_sv_undef |
| 151 handler->args = args; |
152 ? newSVsv(callback) : NULL); |
| |
153 handler->data = (data != NULL && data != &PL_sv_undef |
| |
154 ? newSVsv(data) : NULL); |
| 152 |
155 |
| 153 timeout_handlers = g_list_append(timeout_handlers, handler); |
156 timeout_handlers = g_list_append(timeout_handlers, handler); |
| |
157 |
| 154 handler->iotag = g_timeout_add(seconds * 1000, perl_timeout_cb, handler); |
158 handler->iotag = g_timeout_add(seconds * 1000, perl_timeout_cb, handler); |
| 155 } |
159 } |
| 156 |
160 |
| 157 void |
161 void |
| 158 gaim_perl_timeout_clear_for_plugin(GaimPlugin *plugin) |
162 gaim_perl_timeout_clear_for_plugin(GaimPlugin *plugin) |