changeset 28776:0486e2a9b48f

When switching the account in the Disco / Room List dialogs, kill the visible results, as the results are not at all guaranteed to be applicable to the newly-selected account. Among other things, this happens when you disconnect an account with the Disco Browser or Room List dialogs open.
author Paul Aurich <paul@darkrain42.org>
date Mon, 19 Oct 2009 22:56:27 +0000
parents 41992511531f
children 596dc351c162
files pidgin/gtkroomlist.c pidgin/plugins/disco/gtkdisco.c
diffstat 2 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkroomlist.c	Sat Oct 17 00:37:04 2009 +0000
+++ b/pidgin/gtkroomlist.c	Mon Oct 19 22:56:27 2009 +0000
@@ -111,7 +111,18 @@
 static void dialog_select_account_cb(GObject *w, PurpleAccount *account,
 				     PidginRoomlistDialog *dialog)
 {
+	gboolean change = (account != dialog->account);
 	dialog->account = account;
+
+	if (change && dialog->roomlist) {
+		PidginRoomlist *rl = dialog->roomlist->ui_data;
+		if (rl->tree) {
+			gtk_widget_destroy(rl->tree);
+			rl->tree = NULL;
+		}
+		purple_roomlist_unref(dialog->roomlist);
+		dialog->roomlist = NULL;
+	}
 }
 
 static void list_button_cb(GtkButton *button, PidginRoomlistDialog *dialog)
--- a/pidgin/plugins/disco/gtkdisco.c	Sat Oct 17 00:37:04 2009 +0000
+++ b/pidgin/plugins/disco/gtkdisco.c	Mon Oct 19 22:56:27 2009 +0000
@@ -141,8 +141,18 @@
 static void dialog_select_account_cb(GObject *w, PurpleAccount *account,
                                      PidginDiscoDialog *dialog)
 {
+	gboolean change = (account != dialog->account);
 	dialog->account = account;
 	gtk_widget_set_sensitive(dialog->browse_button, account != NULL);
+
+	if (change && dialog->discolist) {
+		if (dialog->discolist->tree) {
+			gtk_widget_destroy(dialog->discolist->tree);
+			dialog->discolist->tree = NULL;
+		}
+		pidgin_disco_list_unref(dialog->discolist);
+		dialog->discolist = NULL;
+	}
 }
 
 static void register_button_cb(GtkWidget *unused, PidginDiscoDialog *dialog)