diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2013-10-23 21:08:35 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2013-10-23 21:08:35 -0500 |
commit | 2d8ee13a66a78d2e74a699d0bccc3316fb64aaef (patch) | |
tree | f788b4acae721ee5d8cfd9211f3a780d6d75aaed /libindicator | |
parent | 40b4288ef38837a17321d0273c26befe7c8c89b0 (diff) | |
download | libayatana-indicator-2d8ee13a66a78d2e74a699d0bccc3316fb64aaef.tar.gz libayatana-indicator-2d8ee13a66a78d2e74a699d0bccc3316fb64aaef.tar.bz2 libayatana-indicator-2d8ee13a66a78d2e74a699d0bccc3316fb64aaef.zip |
minor cleanup in the dispose() and finalize() functions
Diffstat (limited to 'libindicator')
-rw-r--r-- | libindicator/indicator-service.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index 18c87fc..1cd6964 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -233,10 +233,7 @@ indicator_service_dispose (GObject *object) { IndicatorServicePrivate * priv = INDICATOR_SERVICE_GET_PRIVATE(object); - if (priv->watchers != NULL) { - g_hash_table_destroy(priv->watchers); - priv->watchers = NULL; - } + g_clear_pointer (&priv->watchers, g_hash_table_destroy); if (priv->timeout != 0) { g_source_remove(priv->timeout); @@ -249,10 +246,7 @@ indicator_service_dispose (GObject *object) priv->dbus_registration = 0; } - if (priv->bus != NULL) { - g_object_unref(priv->bus); - priv->bus = NULL; - } + g_clear_object (&priv->bus); if (priv->bus_cancel != NULL) { g_cancellable_cancel(priv->bus_cancel); @@ -271,14 +265,8 @@ indicator_service_finalize (GObject *object) { IndicatorServicePrivate * priv = INDICATOR_SERVICE_GET_PRIVATE(object); - if (priv->name != NULL) { - g_free(priv->name); - } - - if (priv->watchers != NULL) { - g_hash_table_destroy(priv->watchers); - priv->watchers = NULL; - } + g_free (priv->name); + g_clear_pointer (&priv->watchers, g_hash_table_destroy); G_OBJECT_CLASS (indicator_service_parent_class)->finalize (object); return; |