[gnome-calendar] source-dialog: use g_clear_object instead of manual free



commit e3e30140b3a19e10b5637fb1e9a1d267d2bc313f
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed May 6 09:30:22 2015 -0300

    source-dialog: use g_clear_object instead of manual free

 src/gcal-source-dialog.c |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)
---
diff --git a/src/gcal-source-dialog.c b/src/gcal-source-dialog.c
index 32d9a8a..a8506af 100644
--- a/src/gcal-source-dialog.c
+++ b/src/gcal-source-dialog.c
@@ -357,8 +357,7 @@ back_button_clicked (GtkButton *button,
       gcal_manager_save_source (priv->manager, priv->source);
 
       // Release the source ref we acquired
-      g_object_unref (priv->source);
-      priv->source = NULL;
+      g_clear_object (&priv->source);
     }
 
   gcal_source_dialog_set_mode (GCAL_SOURCE_DIALOG (user_data), GCAL_SOURCE_DIALOG_MODE_NORMAL);
@@ -434,10 +433,7 @@ cancel_button_clicked (GtkWidget *button,
 
   // Destroy the ongoing created source
   if (priv->source != NULL)
-    {
-      g_object_unref (priv->source);
-      priv->source = NULL;
-    }
+    g_clear_object (&priv->source);
 
   // Cleanup detected remote sources that weren't added
   if (priv->remote_sources != NULL)
@@ -757,8 +753,7 @@ response_signal (GtkDialog *dialog,
     {
       gcal_manager_save_source (priv->manager, priv->source);
 
-      g_object_unref (priv->source);
-      priv->source = NULL;
+      g_clear_object (&priv->source);
     }
 
   /* commit the new source */


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