# HG changeset patch # User Paul Aurich # Date 1238478013 0 # Node ID cda9031ecabc841273fd6b9f5dc3a1a08351dc51 # Parent de05bdd931ed242caaf32fe31230708d030b5db1 Clean up Jabber's references and protocol_data if the window is closed diff -r de05bdd931ed -r cda9031ecabc libpurple/protocols/jabber/disco.c --- a/libpurple/protocols/jabber/disco.c Tue Mar 31 05:22:44 2009 +0000 +++ b/libpurple/protocols/jabber/disco.c Tue Mar 31 05:40:13 2009 +0000 @@ -655,6 +655,13 @@ --list_data->fetch_count; + if (list_data->list == NULL) { + if (list_data->fetch_count == 0) + jabber_disco_list_data_destroy(list_data); + + return; + } + if (!from || !result || !query || strcmp(result, "result") != 0) { if (list_data->fetch_count == 0) purple_disco_list_set_in_progress(list, FALSE); @@ -743,6 +750,13 @@ --list_data->fetch_count; + if (list_data->list == NULL) { + if (list_data->fetch_count == 0) + jabber_disco_list_data_destroy(list_data); + + return; + } + if (!from || !result || strcmp(result, "result") != 0 || (!(query = xmlnode_get_child(packet, "query"))) || (!(ident = xmlnode_get_child(query, "identity")))) { @@ -981,9 +995,16 @@ if (list_data->fetch_count == 0) { /* Nothing outstanding, just free it now... */ jabber_disco_list_data_destroy(list_data); - } else - /* We'll free it when the count is 0 */ + } else { + int i; + /* Lose all our references to the PurpleDiscoList */ + for (i = 0; i < list_data->fetch_count; ++i) { + purple_disco_list_unref(list); + } + + /* We'll free list_data when fetch_count is down to 0 */ list_data->list = NULL; + } } int