[calls] mm-provider: Prefer g_clear_*() in dispose() and finalize()



commit d0c4374a0b3ad0a5b0e0a009d6eebceb5b815229
Author: Evangelos Ribeiro Tzaras <devrtz fortysixandtwo eu>
Date:   Sat Sep 3 10:51:57 2022 +0200

    mm-provider: Prefer g_clear_*() in dispose() and finalize()

 plugins/provider/mm/calls-mm-provider.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/plugins/provider/mm/calls-mm-provider.c b/plugins/provider/mm/calls-mm-provider.c
index e6ecc0fa..64d05554 100644
--- a/plugins/provider/mm/calls-mm-provider.c
+++ b/plugins/provider/mm/calls-mm-provider.c
@@ -387,10 +387,7 @@ dispose (GObject *object)
 {
   CallsMMProvider *self = CALLS_MM_PROVIDER (object);
 
-  if (self->watch_id) {
-    g_bus_unwatch_name (self->watch_id);
-    self->watch_id = 0;
-  }
+  g_clear_handle_id (&self->watch_id, g_bus_unwatch_name);
 
   g_list_store_remove_all (self->origins);
 
@@ -403,8 +400,8 @@ finalize (GObject *object)
 {
   CallsMMProvider *self = CALLS_MM_PROVIDER (object);
 
-  g_object_unref (self->origins);
-  g_free (self->status);
+  g_clear_object (&self->origins);
+  g_clear_pointer (&self->status, g_free);
 
   G_OBJECT_CLASS (calls_mm_provider_parent_class)->finalize (object);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]