Blob Blame History Raw
From 6ee38dd8fb792a944ea597c9eba21f382d9c4836 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Mon, 31 Aug 2015 15:42:13 +0200
Subject: [PATCH] libnm-gtk: fix a possible crash on widgets destroy (rh
 #1254043)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

https://bugzilla.redhat.com/show_bug.cgi?id=1254043

(cherry picked from commit 0d0e84316f5db87b4909f09060c596dfe48a69e7)
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
 src/libnm-gtk/nm-ui-utils.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/libnm-gtk/nm-ui-utils.c b/src/libnm-gtk/nm-ui-utils.c
index 9119deb..138bbea 100644
--- a/src/libnm-gtk/nm-ui-utils.c
+++ b/src/libnm-gtk/nm-ui-utils.c
@@ -730,13 +730,13 @@ typedef struct {
 } PopupMenuItemInfo;
 
 static void
-popup_menu_item_info_destroy (gpointer data)
+popup_menu_item_info_destroy (gpointer data, GClosure *closure)
 {
 	PopupMenuItemInfo *info = (PopupMenuItemInfo *) data;
 
 	if (info->setting)
 		g_object_unref (info->setting);
-	g_slice_free (PopupMenuItemInfo, data);
+	g_slice_free (PopupMenuItemInfo, info);
 }
 
 static void
@@ -824,11 +824,8 @@ nma_utils_setup_password_storage (GtkWidget *passwd_entry,
 	if (with_not_required)
 		gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item[3]);
 
-	if (setting)
-		g_object_ref (setting);
-
 	info = g_slice_new0 (PopupMenuItemInfo);
-	info->setting = setting;
+	info->setting = setting ? g_object_ref (setting) : NULL;
 	info->password_flags_name = password_flags_name;
 	info->item_number = ITEM_STORAGE_USER;
 	info->passwd_entry = passwd_entry;
@@ -838,7 +835,7 @@ nma_utils_setup_password_storage (GtkWidget *passwd_entry,
 	                       (GClosureNotify) popup_menu_item_info_destroy, 0);
 
 	info = g_slice_new0 (PopupMenuItemInfo);
-	info->setting = setting;
+	info->setting = setting ? g_object_ref (setting) : NULL;
 	info->password_flags_name = password_flags_name;
 	info->item_number = ITEM_STORAGE_SYSTEM;
 	info->passwd_entry = passwd_entry;
@@ -848,7 +845,7 @@ nma_utils_setup_password_storage (GtkWidget *passwd_entry,
 	                       (GClosureNotify) popup_menu_item_info_destroy, 0);
 
 	info = g_slice_new0 (PopupMenuItemInfo);
-	info->setting = setting;
+	info->setting = setting ? g_object_ref (setting) : NULL;
 	info->password_flags_name = password_flags_name;
 	info->item_number = ITEM_STORAGE_ASK;
 	info->passwd_entry = passwd_entry;
@@ -860,7 +857,7 @@ nma_utils_setup_password_storage (GtkWidget *passwd_entry,
 
 	if (with_not_required) {
 		info = g_slice_new0 (PopupMenuItemInfo);
-		info->setting = setting;
+		info->setting = setting ? g_object_ref (setting) : NULL;
 		info->password_flags_name = password_flags_name;
 		info->item_number = ITEM_STORAGE_UNUSED;
 		info->passwd_entry = passwd_entry;
-- 
2.1.0

From d5e25cfd45e485de9be23b5c40196462dd770e73 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Fri, 11 Sep 2015 23:09:44 +0200
Subject: [PATCH] wireless-security: fix an initial sensitivity of "Show
 password" checkbox
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

It also fixes the strange error when clicking "Cancel" in the editor:
(nm-connection-editor:13074): Gtk-CRITICAL **: gtk_event_controller_reset: assertion 'GTK_IS_EVENT_CONTROLLER (controller)' failed

12773	              gtk_event_controller_reset (data->controller);
(gdb) p data
$121 = (EventControllerData *) 0x1448c80
(gdb) p *data
$122 = {controller = 0x0, evmask_notify_id = 22028, grab_notify_id = 22029, sequence_state_changed_id = 22030}

It was invoked by
Breakpoint 1, destroy (parent=0x103c600) at eap-method-ttls.c:46
48		if (method->size_group)
eap_method_unref (method=0x103c600) at eap-method.c:196
199				g_object_unref (method->ui_widget);

(cherry picked from commit 9aa77ea2ca2b0699f8a86e5c7c2a5c92a7256f48)
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
 src/wireless-security/eap-method-simple.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/wireless-security/eap-method-simple.c b/src/wireless-security/eap-method-simple.c
index 557bc74..bffe179 100644
--- a/src/wireless-security/eap-method-simple.c
+++ b/src/wireless-security/eap-method-simple.c
@@ -235,6 +235,7 @@ set_userpass_ui (EAPMethodSimple *method)
 		gtk_entry_set_text (method->password_entry, "");
 
 	gtk_toggle_button_set_active (method->show_password, method->ws_parent->show_password);
+	password_storage_changed (NULL, NULL, method);
 }
 
 static void
-- 
2.1.0