From 9859b59476b732a4e2dbbe2bb00d960fe2c4cc68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= Date: Tue, 1 Sep 2015 09:49:46 +0200 Subject: [PATCH] libnm-gtk: fix a possible crash on password widget destroy (rh #1254043) https://bugzilla.redhat.com/show_bug.cgi?id=1254043 --- network-manager-applet.spec | 7 ++- rh1254043-applet-password-crash.patch | 80 +++++++++++++++++++++++++++ 2 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 rh1254043-applet-password-crash.patch diff --git a/network-manager-applet.spec b/network-manager-applet.spec index c9887aa..b9c45f0 100644 --- a/network-manager-applet.spec +++ b/network-manager-applet.spec @@ -11,7 +11,7 @@ Name: network-manager-applet Summary: A network control and status applet for NetworkManager Version: %{realversion} -Release: 2%{snapshot}%{?dist} +Release: 3%{snapshot}%{?dist} Group: Applications/System License: GPLv2+ URL: http://www.gnome.org/projects/NetworkManager/ @@ -19,6 +19,7 @@ Obsoletes: NetworkManager-gnome < %{obsoletes_ver} Source: https://download.gnome.org/sources/network-manager-applet/1.0/%{name}-%{realversion}%{snapshot}.tar.xz Patch0: nm-applet-no-notifications.patch +Patch1: rh1254043-applet-password-crash.patch Requires: NetworkManager >= %{nm_version} Requires: NetworkManager-glib >= %{nm_version} @@ -94,6 +95,7 @@ nm-applet, nm-connection-editor, and the GNOME control center. %prep %setup -q -n network-manager-applet-%{realversion} %patch0 -p1 -b .no-notifications +%patch1 -p1 -b .rh1254043-applet-password-crash %build autoreconf -i -f @@ -208,6 +210,9 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &>/dev/null || : %{_datadir}/gir-1.0/NMGtk-1.0.gir %changelog +* Tue Sep 1 2015 Jiří Klimeš - 1.0.6-3 +- libnm-gtk: fix a possible crash on password widget destroy (rh #1254043) + * Thu Aug 27 2015 Lubomir Rintel - 1.0.6-2 - Re-add an accidentally removed patch diff --git a/rh1254043-applet-password-crash.patch b/rh1254043-applet-password-crash.patch new file mode 100644 index 0000000..05df875 --- /dev/null +++ b/rh1254043-applet-password-crash.patch @@ -0,0 +1,80 @@ +From 6ee38dd8fb792a944ea597c9eba21f382d9c4836 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= +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š +--- + 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 +