changeset 28900:6126436715e8

xmppdisco: Close the input request when closing the dialog. Fixes a crash.
author Paul Aurich <paul@darkrain42.org>
date Sat, 07 Nov 2009 03:45:13 +0000
parents 9832ae3b94fd
children 13e668ef158d
files pidgin/plugins/disco/gtkdisco.c pidgin/plugins/disco/gtkdisco.h
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/plugins/disco/gtkdisco.c	Fri Nov 06 21:28:04 2009 +0000
+++ b/pidgin/plugins/disco/gtkdisco.c	Sat Nov 07 03:45:13 2009 +0000
@@ -162,12 +162,15 @@
 
 static void discolist_cancel_cb(PidginDiscoList *pdl, const char *server)
 {
+	pdl->dialog->prompt_handle = NULL;
+
 	pidgin_disco_list_set_in_progress(pdl, FALSE);
 	pidgin_disco_list_unref(pdl);
 }
 
 static void discolist_ok_cb(PidginDiscoList *pdl, const char *server)
 {
+	pdl->dialog->prompt_handle = NULL;
 	gtk_widget_set_sensitive(pdl->dialog->browse_button, TRUE);
 
 	if (!server || !*server) {
@@ -236,7 +239,7 @@
 
 	/* Note to translators: The string "Enter an XMPP Server" is asking the
 	   user to type the name of an XMPP server which will then be queried */
-	purple_request_input(my_plugin, _("Server name request"), _("Enter an XMPP Server"),
+	dialog->prompt_handle = purple_request_input(my_plugin, _("Server name request"), _("Enter an XMPP Server"),
 			_("Select an XMPP server to query"),
 			server, FALSE, FALSE, NULL,
 			_("Find Services"), PURPLE_CALLBACK(discolist_ok_cb),
@@ -390,6 +393,9 @@
 	PidginDiscoDialog *dialog = d;
 	PidginDiscoList *list = dialog->discolist;
 
+	if (dialog->prompt_handle)
+		purple_request_close(PURPLE_REQUEST_INPUT, dialog->prompt_handle);
+
 	if (list) {
 		list->dialog = NULL;
 
--- a/pidgin/plugins/disco/gtkdisco.h	Fri Nov 06 21:28:04 2009 +0000
+++ b/pidgin/plugins/disco/gtkdisco.h	Sat Nov 07 03:45:13 2009 +0000
@@ -43,6 +43,8 @@
 
 	PurpleAccount *account;
 	PidginDiscoList *discolist;
+
+	gpointer *prompt_handle;
 };
 
 struct _PidginDiscoList {