diff options
author | dequis <dx@dxzone.com.ar> | 2016-11-13 17:00:04 -0300 |
---|---|---|
committer | dequis <dx@dxzone.com.ar> | 2016-11-13 17:10:17 -0300 |
commit | ea902752503fc5b356d6513911081ec932d804f2 (patch) | |
tree | 6f4ffe40d03a50ed28a59f644b5406ca9f8fb38f /protocols/purple/purple.c | |
parent | 701ab8129ba9ea64f569daedca9a8603abad740f (diff) |
purple: fix file transfer memory management
This means cancelling transfers on logout to avoid crashes, keeping
track of timeouts, reffing and unreffing the xfers, listening to the
callbacks from UI and purple more carefully and using the correct
functions to free the correct things at the correct moments.
Originally intended to fix a crash triggered when the dcc stall timeout
kicks in after the account is offline, which is apparently very frequent
with telegram (it sends file transfers while fetching history, and
randomly disconnects a while later).
Trying to fix that meant opening a can of worms, but after three days of
work on this bug I'm pretty sure I've finished dealing with the
resulting mess and tested all the typical edge cases.
Diffstat (limited to 'protocols/purple/purple.c')
-rw-r--r-- | protocols/purple/purple.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/protocols/purple/purple.c b/protocols/purple/purple.c index d476afba..4ee41d62 100644 --- a/protocols/purple/purple.c +++ b/protocols/purple/purple.c @@ -42,6 +42,8 @@ static char *set_eval_display_name(set_t *set, char *value); void purple_request_input_callback(guint id, struct im_connection *ic, const char *message, const char *who); +void purple_transfer_cancel_all(struct im_connection *ic); + /* purple_request_input specific stuff */ typedef void (*ri_callback_t)(gpointer, const gchar *); @@ -384,6 +386,10 @@ static void purple_logout(struct im_connection *ic) imcb_chat_free(ic->groupchats->data); } + if (pd->filetransfers) { + purple_transfer_cancel_all(ic); + } + purple_account_set_enabled(pd->account, "BitlBee", FALSE); purple_connections = g_slist_remove(purple_connections, ic); purple_accounts_remove(pd->account); |