From 8659889054f49ff674562c0f7c8ae7929e837d67 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 26 Oct 2012 09:05:25 +0200 Subject: fix leaked icon and label; found by running valgrind on tests/test-indicator --- src/indicator-power.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/indicator-power.c b/src/indicator-power.c index 9829839..ebfc2c1 100644 --- a/src/indicator-power.c +++ b/src/indicator-power.c @@ -150,6 +150,8 @@ indicator_power_dispose (GObject *object) dispose_devices (self); + g_clear_object (&priv->label); + g_clear_object (&priv->status_image); g_clear_object (&priv->dbus_listener); g_clear_object (&priv->settings); @@ -489,6 +491,7 @@ get_label (IndicatorObject *io) { /* Create the label if it doesn't exist already */ priv->label = GTK_LABEL (gtk_label_new ("")); + g_object_ref_sink (priv->label); gtk_widget_set_visible (GTK_WIDGET (priv->label), FALSE); } @@ -508,6 +511,7 @@ get_image (IndicatorObject *io) gicon = g_themed_icon_new (DEFAULT_ICON); priv->status_image = GTK_IMAGE (gtk_image_new_from_gicon (gicon, GTK_ICON_SIZE_LARGE_TOOLBAR)); + g_object_ref_sink (priv->status_image); g_object_unref (gicon); } -- cgit v1.2.3