comparison libpurple/protocols/jabber/disco.c @ 26338:cda9031ecabc

Clean up Jabber's references and protocol_data if the window is closed
author Paul Aurich <paul@darkrain42.org>
date Tue, 31 Mar 2009 05:40:13 +0000
parents de05bdd931ed
children ce23e32a0ada
comparison
equal deleted inserted replaced
26337:de05bdd931ed 26338:cda9031ecabc
653 list_data = disco_data->list_data; 653 list_data = disco_data->list_data;
654 list = list_data->list; 654 list = list_data->list;
655 655
656 --list_data->fetch_count; 656 --list_data->fetch_count;
657 657
658 if (list_data->list == NULL) {
659 if (list_data->fetch_count == 0)
660 jabber_disco_list_data_destroy(list_data);
661
662 return;
663 }
664
658 if (!from || !result || !query || strcmp(result, "result") != 0) { 665 if (!from || !result || !query || strcmp(result, "result") != 0) {
659 if (list_data->fetch_count == 0) 666 if (list_data->fetch_count == 0)
660 purple_disco_list_set_in_progress(list, FALSE); 667 purple_disco_list_set_in_progress(list, FALSE);
661 668
662 purple_disco_list_unref(list); 669 purple_disco_list_unref(list);
741 g_free(disco_data->node); 748 g_free(disco_data->node);
742 g_free(disco_data); 749 g_free(disco_data);
743 750
744 --list_data->fetch_count; 751 --list_data->fetch_count;
745 752
753 if (list_data->list == NULL) {
754 if (list_data->fetch_count == 0)
755 jabber_disco_list_data_destroy(list_data);
756
757 return;
758 }
759
746 if (!from || !result || strcmp(result, "result") != 0 760 if (!from || !result || strcmp(result, "result") != 0
747 || (!(query = xmlnode_get_child(packet, "query"))) 761 || (!(query = xmlnode_get_child(packet, "query")))
748 || (!(ident = xmlnode_get_child(query, "identity")))) { 762 || (!(ident = xmlnode_get_child(query, "identity")))) {
749 if (list_data->fetch_count == 0) 763 if (list_data->fetch_count == 0)
750 purple_disco_list_set_in_progress(list, FALSE); 764 purple_disco_list_set_in_progress(list, FALSE);
979 purple_disco_list_set_protocol_data(list, NULL, NULL); 993 purple_disco_list_set_protocol_data(list, NULL, NULL);
980 994
981 if (list_data->fetch_count == 0) { 995 if (list_data->fetch_count == 0) {
982 /* Nothing outstanding, just free it now... */ 996 /* Nothing outstanding, just free it now... */
983 jabber_disco_list_data_destroy(list_data); 997 jabber_disco_list_data_destroy(list_data);
984 } else 998 } else {
985 /* We'll free it when the count is 0 */ 999 int i;
1000 /* Lose all our references to the PurpleDiscoList */
1001 for (i = 0; i < list_data->fetch_count; ++i) {
1002 purple_disco_list_unref(list);
1003 }
1004
1005 /* We'll free list_data when fetch_count is down to 0 */
986 list_data->list = NULL; 1006 list_data->list = NULL;
1007 }
987 } 1008 }
988 1009
989 int 1010 int
990 jabber_disco_service_register(PurpleConnection *gc, PurpleDiscoService *service) 1011 jabber_disco_service_register(PurpleConnection *gc, PurpleDiscoService *service)
991 { 1012 {