[network-manager-applet/th/applet-icon-crash-bgo762421: 1/6] applet: minor refactoring and drop nma_clear_icon()



commit 7718b4875953a021e620a816a4ef95da0022a9af
Author: Thomas Haller <thaller redhat com>
Date:   Wed Feb 24 18:30:01 2016 +0100

    applet: minor refactoring and drop nma_clear_icon()

 src/applet.c |   28 ++++++++++------------------
 1 files changed, 10 insertions(+), 18 deletions(-)
---
diff --git a/src/applet.c b/src/applet.c
index dde4bcb..b735700 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -2081,9 +2081,9 @@ foo_set_icon (NMApplet *applet, guint32 layer, GdkPixbuf *pixbuf, char *icon_nam
                                continue;
 
                        gdk_pixbuf_composite (top, pixbuf, 0, 0, gdk_pixbuf_get_width (top),
-                                                         gdk_pixbuf_get_height (top),
-                                                         0, 0, 1.0, 1.0,
-                                                         GDK_INTERP_NEAREST, 255);
+                                             gdk_pixbuf_get_height (top),
+                                             0, 0, 1.0, 1.0,
+                                             GDK_INTERP_NEAREST, 255);
                }
        } else
                pixbuf = g_object_ref (nma_icon_check_and_load ("nm-no-connection", applet));
@@ -2917,24 +2917,16 @@ applet_agent_cancel_secrets_cb (AppletAgent *agent,
 
 /*****************************************************************************/
 
-static void
-nma_clear_icon (GdkPixbuf **icon, NMApplet *applet)
-{
-       g_return_if_fail (icon != NULL);
-       g_return_if_fail (applet != NULL);
-
-       if (*icon && (*icon != applet->fallback_icon)) {
-               g_object_unref (*icon);
-               *icon = NULL;
-       }
-}
-
 static void nma_icons_free (NMApplet *applet)
 {
-       int i;
+       guint i;
 
-       for (i = 0; i <= ICON_LAYER_MAX; i++)
-               nma_clear_icon (&applet->icon_layers[i], 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]);
+       }
 }
 
 GdkPixbuf *


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