From a32a078bd850762c40577db69d589f660bf5e957 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Feb 2010 15:12:29 -0600 Subject: Getting some new private variables, and making sure they have a full lifecycle. --- libindicator/indicator-desktop-shortcuts.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/libindicator/indicator-desktop-shortcuts.c b/libindicator/indicator-desktop-shortcuts.c index 845f997..e6f5a69 100644 --- a/libindicator/indicator-desktop-shortcuts.c +++ b/libindicator/indicator-desktop-shortcuts.c @@ -30,6 +30,8 @@ License along with this library. If not, see typedef struct _IndicatorDesktopShortcutsPrivate IndicatorDesktopShortcutsPrivate; struct _IndicatorDesktopShortcutsPrivate { GKeyFile * keyfile; + gchar * identity; + GArray * nicks; }; #define INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(o) \ @@ -63,6 +65,8 @@ indicator_desktop_shortcuts_init (IndicatorDesktopShortcuts *self) IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(self); priv->keyfile = NULL; + priv->identity = NULL; + priv->nicks = g_array_new(TRUE, TRUE, sizeof(gchar *)); return; } @@ -71,6 +75,13 @@ indicator_desktop_shortcuts_init (IndicatorDesktopShortcuts *self) static void indicator_desktop_shortcuts_dispose (GObject *object) { + IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(object); + + if (priv->keyfile) { + g_key_file_free(priv->keyfile); + priv->keyfile = NULL; + } + G_OBJECT_CLASS (indicator_desktop_shortcuts_parent_class)->dispose (object); return; @@ -80,6 +91,22 @@ indicator_desktop_shortcuts_dispose (GObject *object) static void indicator_desktop_shortcuts_finalize (GObject *object) { + IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(object); + + if (priv->identity != NULL) { + g_free(priv->identity); + priv->identity = NULL; + } + + if (priv->nicks != NULL) { + gint i; + for (i = 0; i < priv->nicks->len; i++) { + gchar * nick = g_array_index(priv->nicks, gchar *, i); + g_free(nick); + } + g_array_free(priv->nicks, TRUE); + priv->nicks = NULL; + } G_OBJECT_CLASS (indicator_desktop_shortcuts_parent_class)->finalize (object); return; -- cgit v1.2.3