From 85a04b44e3e4f77db07c52ab8667195c6c98cedf Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 1 Feb 2012 18:55:19 -0600 Subject: unref+clear Priv's variant fields in _dispose() --- src/indicator-power.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/indicator-power.c b/src/indicator-power.c index 6b95b4c..4eebf3a 100644 --- a/src/indicator-power.c +++ b/src/indicator-power.c @@ -50,6 +50,11 @@ with this program. If not, see . #define IS_INDICATOR_POWER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), INDICATOR_POWER_TYPE)) #define INDICATOR_POWER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), INDICATOR_POWER_TYPE, IndicatorPowerClass)) +GType indicator_power_get_type (void); + +INDICATOR_SET_VERSION +INDICATOR_SET_TYPE (INDICATOR_POWER_TYPE) + typedef struct _IndicatorPower IndicatorPower; typedef struct _IndicatorPowerClass IndicatorPowerClass; typedef struct _IndicatorPowerPrivate IndicatorPowerPrivate; @@ -66,8 +71,6 @@ struct _IndicatorPowerClass IndicatorObjectClass parent_class; }; -GType indicator_power_get_type (void) G_GNUC_CONST; - struct _IndicatorPowerPrivate { @@ -101,10 +104,6 @@ static const gchar* get_name_hint (IndicatorObject * io); G_DEFINE_TYPE (IndicatorPower, indicator_power, INDICATOR_OBJECT_TYPE); -/* Indicator stuff */ -INDICATOR_SET_VERSION -INDICATOR_SET_TYPE (INDICATOR_POWER_TYPE) - static void indicator_power_class_init (IndicatorPowerClass *klass) @@ -901,6 +900,16 @@ indicator_power_dispose (GObject *object) { IndicatorPowerPrivate *priv = INDICATOR_POWER(object)->priv; + if (priv->devices != NULL) { + g_variant_unref (priv->devices); + priv->devices = NULL; + } + + if (priv->device != NULL) { + g_variant_unref (priv->device); + priv->device = NULL; + } + g_clear_object (&priv->settings); G_OBJECT_CLASS (indicator_power_parent_class)->dispose (object); -- cgit v1.2.3