[gnome-settings-daemon] power: Do not leak the icon when getting device status



commit 15dcc15bd1900911bb336747fb856d71cda7198a
Author: Richard Hughes <richard hughsie com>
Date:   Fri Sep 16 09:04:18 2011 +0100

    power: Do not leak the icon when getting device status
    
    Resoves https://bugzilla.gnome.org/show_bug.cgi?id=659213

 plugins/power/gsd-power-manager.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index 99506f3..4c29099 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -646,14 +646,14 @@ engine_recalculate_state_icon (GsdPowerManager *manager)
                 gtk_status_icon_set_from_gicon (manager->priv->status_icon, icon);
 
                 engine_emit_changed (manager);
-                manager->priv->previous_icon = g_object_ref (icon);
+                manager->priv->previous_icon = icon;
                 return TRUE;
         }
 
         /* icon before, now different */
         if (!g_icon_equal (manager->priv->previous_icon, icon)) {
                 g_object_unref (manager->priv->previous_icon);
-                manager->priv->previous_icon = g_object_ref (icon);
+                manager->priv->previous_icon = icon;
 
                 /* set fallback icon */
                 gtk_status_icon_set_from_gicon (manager->priv->status_icon, icon);
@@ -3646,6 +3646,7 @@ device_to_variant_blob (UpDevice *device)
                                state,
                                time_state);
         g_free (device_icon);
+        g_object_unref (icon);
         return value;
 }
 



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