From e3e30140b3a19e10b5637fb1e9a1d267d2bc313f Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Wed, 6 May 2015 09:30:22 -0300 Subject: [PATCH] source-dialog: use g_clear_object instead of manual free --- src/gcal-source-dialog.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/gcal-source-dialog.c b/src/gcal-source-dialog.c index 32d9a8a8..a8506aff 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 */