diff gtk/gtkblist.c @ 15221:152756b02fca

[gaim-migrate @ 18010] Do not use gtkblist after freeing and setting it to NULL. Disconnect from the all signals when uniniting. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 16 Dec 2006 09:58:26 +0000
parents c9bb2131bdf3
children 26357b7f117e
line wrap: on
line diff
--- a/gtk/gtkblist.c	Fri Dec 15 10:35:18 2006 +0000
+++ b/gtk/gtkblist.c	Sat Dec 16 09:58:26 2006 +0000
@@ -4794,6 +4794,8 @@
 
 static void gaim_gtk_blist_update(GaimBuddyList *list, GaimBlistNode *node)
 {
+	if (list)
+		gtkblist = GAIM_GTK_BLIST(list);
 	if(!gtkblist || !node)
 		return;
 
@@ -4828,10 +4830,7 @@
 	if (!gtkblist)
 		return;
 
-	gaim_signal_disconnect(gaim_connections_get_handle(), "signed-on",
-						   gtkblist, GAIM_CALLBACK(sign_on_off_cb));
-	gaim_signal_disconnect(gaim_connections_get_handle(), "signed-off",
-						   gtkblist, GAIM_CALLBACK(sign_on_off_cb));
+	gaim_signals_disconnect_by_handle(gtkblist);
 
 	gtk_widget_destroy(gtkblist->window);
 
@@ -4851,15 +4850,15 @@
 	gtkblist->window = gtkblist->vbox = gtkblist->treeview = NULL;
 	gtkblist->treemodel = NULL;
 	g_object_unref(G_OBJECT(gtkblist->ift));
-	g_free(gtkblist);
-	accountmenu = NULL;
-	gtkblist = NULL;
 
 	gdk_cursor_unref(gtkblist->hand_cursor);
 	gdk_cursor_unref(gtkblist->arrow_cursor);
 	gtkblist->hand_cursor = NULL;
 	gtkblist->arrow_cursor = NULL;
 
+	g_free(gtkblist);
+	accountmenu = NULL;
+	gtkblist = NULL;
 	gaim_prefs_disconnect_by_handle(gaim_gtk_blist_get_handle());
 }
 
@@ -5684,6 +5683,7 @@
 void
 gaim_gtk_blist_uninit(void) {
 	gaim_signals_unregister_by_instance(gaim_gtk_blist_get_handle());
+	gaim_signals_disconnect_by_handle(gaim_gtk_blist_get_handle());
 }
 
 /*********************************************************************