221 } |
221 } |
222 |
222 |
223 free_arg_lst (args); |
223 free_arg_lst (args); |
224 } |
224 } |
225 |
225 |
226 static void disco_free_handlers (void) |
226 static void disco_free_reply_handlers (void) |
227 { |
227 { |
228 GSList *hel; |
228 GSList *hel; |
229 |
229 |
230 if (lconnection) { // XXX more checks? |
230 // let's hope, that after invalidation, lm will remove and free unreffed by us handler |
231 // let's hope, that after invalidation, lm will remove and free unreffed by us handler |
231 for (hel = reply_handlers; hel; hel = hel->next) { |
232 for (hel = reply_handlers; hel; hel = hel->next) { |
232 LmMessageHandler *handler = (LmMessageHandler *) hel->data; |
233 LmMessageHandler *handler = (LmMessageHandler *) hel->data; |
233 lm_message_handler_invalidate (handler); |
234 lm_message_handler_invalidate (handler); |
|
235 } |
|
236 } |
234 } |
237 |
235 |
238 g_slist_free (reply_handlers); |
236 g_slist_free (reply_handlers); |
239 reply_handlers = NULL; |
237 reply_handlers = NULL; |
240 } |
238 } |
241 |
239 |
242 // release handlers before reconnect |
240 // release handlers before reconnect |
243 static void disco_hh (guint32 hid, hk_arg_t *args, gpointer userdata) |
241 static void disco_hh (guint32 hid, hk_arg_t *args, gpointer userdata) |
244 { |
242 { |
245 hk_arg_t *arg = args; |
243 hk_arg_t *arg; |
246 |
244 |
247 for (arg = args; arg->name; arg++) { |
245 for (arg = args; arg->name; arg++) { |
248 if (!strcmp (arg->name, "hook") && !strcmp (arg->value, "hook-pre-disconnect")) { |
246 if (!strcmp (arg->name, "hook") && !strcmp (arg->value, "hook-pre-disconnect")) { |
249 disco_free_handlers (); |
247 disco_free_reply_handlers (); |
250 return; |
248 return; |
251 } |
249 } |
252 } |
250 } |
253 } |
251 } |
254 |
252 |