network-manager-applet/rh1254043-applet-password-crash.patch

81 lines
2.8 KiB
Diff

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