[network-manager-applet/th/applet-icon-crash-bgo762421: 5/6] applet: fix crash due to wrongly handling references for icons
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/th/applet-icon-crash-bgo762421: 5/6] applet: fix crash due to wrongly handling references for icons
- Date: Wed, 24 Feb 2016 19:00:56 +0000 (UTC)
commit c0f782b1c6fefcc8681ea2b158a7ffd09d367ab7
Author: Thomas Haller <thaller redhat com>
Date: Wed Feb 24 19:04:02 2016 +0100
applet: fix crash due to wrongly handling references for icons
nma_icon_check_and_load() would not take an additional reference
for the @fallback_icon.
Note that nma_icons_free() would not unref the icon if it equals the
fallback_icon, but destroying @icon_cache would. So, during finalize()
we hit the bug, but also when nma_icons_reload() replaces
@fallback_icon.
https://bugzilla.gnome.org/show_bug.cgi?id=762421
https://bugzilla.redhat.com/show_bug.cgi?id=1284671
https://bugzilla.redhat.com/show_bug.cgi?id=1279937
src/applet.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/src/applet.c b/src/applet.c
index a376093..3ed7ca0 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -2926,10 +2926,8 @@ static void nma_icons_free (NMApplet *applet)
g_return_if_fail (NM_IS_APPLET (applet));
- for (i = 0; i <= ICON_LAYER_MAX; i++) {
- if (applet->icon_layers[i] != applet->fallback_icon)
- g_clear_object (&applet->icon_layers[i]);
- }
+ for (i = 0; i <= ICON_LAYER_MAX; i++)
+ g_clear_object (&applet->icon_layers[i]);
}
GdkPixbuf *
@@ -2954,7 +2952,8 @@ nma_icon_check_and_load (const char *name, NMApplet *applet)
error->message);
g_clear_error (&error);
- icon = applet->fallback_icon;
+ if (applet->fallback_icon)
+ icon = g_object_ref (applet->fallback_icon);
}
g_hash_table_insert (applet->icon_cache, g_strdup (name), icon);
@@ -3008,8 +3007,8 @@ static void nma_icons_init (NMApplet *applet)
if (applet->icon_theme) {
g_signal_handlers_disconnect_by_func (applet->icon_theme,
- G_CALLBACK (nma_icons_reload),
- applet);
+ G_CALLBACK (nma_icons_reload),
+ applet);
g_object_unref (G_OBJECT (applet->icon_theme));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]