[network-manager-applet/NMA_0_8] applet: fix errors when calling wireless_dialog_close() on destroyed dialog



commit 4276b9ef82e21b5d08eeafa1794ef93f0484478a
Author: JiÅ?í KlimeÅ¡ <jklimes redhat com>
Date:   Thu Aug 5 16:05:15 2010 +0200

    applet: fix errors when calling wireless_dialog_close() on destroyed dialog
    
    Case: When connecting to WPA EAP network, don't specify CA cert, click
    'Connect', on poping dialog click 'Choose CA cert', then again 'Connect'
    (can be repeated more times). And now click 'Ignore'. The connection is
    established, but errors are issued.

 src/applet-device-wifi.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/applet-device-wifi.c b/src/applet-device-wifi.c
index 0821e7f..8548d4b 100644
--- a/src/applet-device-wifi.c
+++ b/src/applet-device-wifi.c
@@ -1357,6 +1357,13 @@ wireless_dialog_close (gpointer user_data)
 }
 
 static void
+wireless_dialog_destroyed (gpointer data, GObject *dialog_ptr)
+{
+	/* remove the idle function; for not to call wireless_dialog_close() on invalid pointer */
+	g_idle_remove_by_data (dialog_ptr);
+}
+
+static void
 nag_dialog_response_cb (GtkDialog *nag_dialog,
                         gint response,
                         gpointer user_data)
@@ -1366,6 +1373,7 @@ nag_dialog_response_cb (GtkDialog *nag_dialog,
 	if (response == GTK_RESPONSE_NO) {  /* user opted not to correct the warning */
 		nma_wireless_dialog_set_nag_ignored (wireless_dialog, TRUE);
 		g_idle_add (wireless_dialog_close, wireless_dialog);
+		g_object_weak_ref (G_OBJECT (wireless_dialog), wireless_dialog_destroyed, NULL);
 	}
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]