aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-10-20 16:57:57 -0500
committerTed Gould <ted@canonical.com>2009-10-20 16:57:57 -0500
commit484b489a81fcfa902bee346b8c158274de8a44f4 (patch)
treeb9da311055d0582a26c887115de3a1004c8be1db /src
parent59d8fbd0166729a3272a39a1197b29d9b898ee36 (diff)
downloadayatana-indicator-application-484b489a81fcfa902bee346b8c158274de8a44f4.tar.gz
ayatana-indicator-application-484b489a81fcfa902bee346b8c158274de8a44f4.tar.bz2
ayatana-indicator-application-484b489a81fcfa902bee346b8c158274de8a44f4.zip
Making sure to free and unref all of our private variables.
Diffstat (limited to 'src')
-rw-r--r--src/libcustomindicator/custom-indicator.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/libcustomindicator/custom-indicator.c b/src/libcustomindicator/custom-indicator.c
index 229eaef..82abd0e 100644
--- a/src/libcustomindicator/custom-indicator.c
+++ b/src/libcustomindicator/custom-indicator.c
@@ -238,17 +238,66 @@ custom_indicator_init (CustomIndicator *self)
return;
}
+/* Free all objects, make sure that all the dbus
+ signals are sent out before we shut this down. */
static void
custom_indicator_dispose (GObject *object)
{
+ CustomIndicator * self = CUSTOM_INDICATOR(object);
+ g_return_if_fail(self != NULL);
+
+ CustomIndicatorPrivate * priv = CUSTOM_INDICATOR_GET_PRIVATE(self);
+ g_return_if_fail(priv != NULL);
+
+ if (priv->status != CUSTOM_INDICATOR_STATUS_OFF) {
+ custom_indicator_set_status(self, CUSTOM_INDICATOR_STATUS_OFF);
+ }
+
+ if (priv->menu != NULL) {
+ g_object_unref(G_OBJECT(priv->menu));
+ priv->menu = NULL;
+ }
+
+ if (priv->watcher_proxy != NULL) {
+ DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL);
+ dbus_g_connection_flush(session_bus);
+ g_object_unref(G_OBJECT(priv->watcher_proxy));
+ priv->watcher_proxy = NULL;
+ }
G_OBJECT_CLASS (custom_indicator_parent_class)->dispose (object);
return;
}
+/* Free all of the memory that we could be using in
+ the object. */
static void
custom_indicator_finalize (GObject *object)
{
+ CustomIndicator * self = CUSTOM_INDICATOR(object);
+ g_return_if_fail(self != NULL);
+
+ CustomIndicatorPrivate * priv = CUSTOM_INDICATOR_GET_PRIVATE(self);
+ g_return_if_fail(priv != NULL);
+
+ if (priv->status != CUSTOM_INDICATOR_STATUS_OFF) {
+ g_warning("Finalizing Custom Status with the status set to: %d", priv->status);
+ }
+
+ if (priv->id != NULL) {
+ g_free(priv->id);
+ priv->id = NULL;
+ }
+
+ if (priv->icon_name != NULL) {
+ g_free(priv->icon_name);
+ priv->icon_name = NULL;
+ }
+
+ if (priv->attention_icon_name != NULL) {
+ g_free(priv->attention_icon_name);
+ priv->attention_icon_name = NULL;
+ }
G_OBJECT_CLASS (custom_indicator_parent_class)->finalize (object);
return;