From 52f7f2da6f9954f5f7cf7bedba08dbab49466e7e Mon Sep 17 00:00:00 2001 From: Adrien Plazas Date: Fri, 3 Aug 2018 11:08:55 +0200 Subject: [PATCH] Drop the CALLS_DISPOSE_OBJECT() macro Replace it by g_clear_object() as it does the same thing. --- src/calls-call-data.c | 4 ++-- src/calls-call-display.c | 2 +- src/calls-call-holder.c | 6 +++--- src/calls-call-selector-item.c | 2 +- src/calls-main-window.c | 4 ++-- src/calls-ofono-call.c | 2 +- src/calls-ofono-object.c | 6 +++--- src/calls-ofono-origin.c | 6 +++--- src/calls-ofono-provider.c | 4 ++-- src/util.h | 8 -------- 10 files changed, 18 insertions(+), 26 deletions(-) diff --git a/src/calls-call-data.c b/src/calls-call-data.c index 7b1bb58..08204df 100644 --- a/src/calls-call-data.c +++ b/src/calls-call-data.c @@ -116,8 +116,8 @@ dispose (GObject *object) GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT); CallsCallData *self = CALLS_CALL_DATA (object); - CALLS_DISPOSE_OBJECT (self->call); - CALLS_DISPOSE_OBJECT (self->party); + g_clear_object (&self->call); + g_clear_object (&self->party); parent_class->dispose (object); } diff --git a/src/calls-call-display.c b/src/calls-call-display.c index 737a882..568d8d1 100644 --- a/src/calls-call-display.c +++ b/src/calls-call-display.c @@ -279,7 +279,7 @@ dispose (GObject *object) GObjectClass *parent_class = g_type_class_peek (GTK_TYPE_BOX); CallsCallDisplay *self = CALLS_CALL_DISPLAY (object); - CALLS_DISPOSE_OBJECT (self->call); + g_clear_object (&self->call); parent_class->dispose (object); } diff --git a/src/calls-call-holder.c b/src/calls-call-holder.c index 2a49dda..56f8905 100644 --- a/src/calls-call-holder.c +++ b/src/calls-call-holder.c @@ -134,9 +134,9 @@ dispose (GObject *object) GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT); CallsCallHolder *self = CALLS_CALL_HOLDER (object); - CALLS_DISPOSE_OBJECT (self->selector_item); - CALLS_DISPOSE_OBJECT (self->display); - CALLS_DISPOSE_OBJECT (self->data); + g_clear_object (&self->selector_item); + g_clear_object (&self->display); + g_clear_object (&self->data); parent_class->dispose (object); } diff --git a/src/calls-call-selector-item.c b/src/calls-call-selector-item.c index 5b4fa2a..344f7b9 100644 --- a/src/calls-call-selector-item.c +++ b/src/calls-call-selector-item.c @@ -191,7 +191,7 @@ dispose (GObject *object) GObjectClass *parent_class = g_type_class_peek (GTK_TYPE_EVENT_BOX); CallsCallSelectorItem *self = CALLS_CALL_SELECTOR_ITEM (object); - CALLS_DISPOSE_OBJECT (self->holder); + g_clear_object (&self->holder); parent_class->dispose (object); } diff --git a/src/calls-main-window.c b/src/calls-main-window.c index c83eb3f..2065ba1 100644 --- a/src/calls-main-window.c +++ b/src/calls-main-window.c @@ -688,8 +688,8 @@ dispose (GObject *object) remove_origins (self); } - CALLS_DISPOSE_OBJECT (self->call_holders); - CALLS_DISPOSE_OBJECT (self->provider); + g_clear_object (&self->call_holders); + g_clear_object (&self->provider); parent_class->dispose (object); } diff --git a/src/calls-ofono-call.c b/src/calls-ofono-call.c index cd8b13e..abbde92 100644 --- a/src/calls-ofono-call.c +++ b/src/calls-ofono-call.c @@ -291,7 +291,7 @@ dispose (GObject *object) GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT); CallsOfonoCall *self = CALLS_OFONO_CALL (object); - CALLS_DISPOSE_OBJECT (self->voice_call); + g_clear_object (&self->voice_call); parent_class->dispose (object); } diff --git a/src/calls-ofono-object.c b/src/calls-ofono-object.c index 2cf715b..3476f3e 100644 --- a/src/calls-ofono-object.c +++ b/src/calls-ofono-object.c @@ -130,9 +130,9 @@ dispose (GObject *object) GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT); CallsOfonoObject *self = CALLS_OFONO_OBJECT (object); - CALLS_DISPOSE_OBJECT (self->selector_item); - CALLS_DISPOSE_OBJECT (self->display); - CALLS_DISPOSE_OBJECT (self->data); + g_clear_object (&self->selector_item); + g_clear_object (&self->display); + g_clear_object (&self->data); parent_class->dispose (object); } diff --git a/src/calls-ofono-origin.c b/src/calls-ofono-origin.c index 791f229..a1ae7f1 100644 --- a/src/calls-ofono-origin.c +++ b/src/calls-ofono-origin.c @@ -476,7 +476,7 @@ constructed (GObject *object) (GAsyncReadyCallback)voice_new_cb, self); - CALLS_DISPOSE_OBJECT (self->modem); + g_clear_object (&self->modem); parent_class->constructed (object); } @@ -489,8 +489,8 @@ dispose (GObject *object) CallsOfonoOrigin *self = CALLS_OFONO_ORIGIN (object); remove_calls (self, NULL); - CALLS_DISPOSE_OBJECT (self->modem); - CALLS_DISPOSE_OBJECT (self->connection); + g_clear_object (&self->modem); + g_clear_object (&self->connection); parent_class->dispose (object); } diff --git a/src/calls-ofono-provider.c b/src/calls-ofono-provider.c index 2f96a04..61f1d5b 100644 --- a/src/calls-ofono-provider.c +++ b/src/calls-ofono-provider.c @@ -442,8 +442,8 @@ dispose (GObject *object) // FIXME - CALLS_DISPOSE_OBJECT (self->manager); - CALLS_DISPOSE_OBJECT (self->connection); + g_clear_object (&self->manager); + g_clear_object (&self->connection); parent_class->dispose (object); } diff --git a/src/util.h b/src/util.h index 02511a1..98870ee 100644 --- a/src/util.h +++ b/src/util.h @@ -71,14 +71,6 @@ G_BEGIN_DECLS -#define CALLS_DISPOSE_OBJECT(obj_ptr) \ - if (obj_ptr) \ - { \ - g_object_unref (G_OBJECT (obj_ptr)); \ - obj_ptr = NULL; \ - } - - #define CALLS_SET_OBJECT_PROPERTY(obj_ptr,new_value) \ if (obj_ptr) \ { \