diff pidgin/plugins/disco/gtkdisco.c @ 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 8d408dff1bff
children 6126436715e8
line wrap: on
line diff
--- 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)