source-dialog: use g_clear_object instead of manual free
This commit is contained in:
committed by
Erick Pérez Castellanos
parent
6213f5cc78
commit
e3e30140b3
@@ -357,8 +357,7 @@ back_button_clicked (GtkButton *button,
|
|||||||
gcal_manager_save_source (priv->manager, priv->source);
|
gcal_manager_save_source (priv->manager, priv->source);
|
||||||
|
|
||||||
// Release the source ref we acquired
|
// Release the source ref we acquired
|
||||||
g_object_unref (priv->source);
|
g_clear_object (&priv->source);
|
||||||
priv->source = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gcal_source_dialog_set_mode (GCAL_SOURCE_DIALOG (user_data), GCAL_SOURCE_DIALOG_MODE_NORMAL);
|
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
|
// Destroy the ongoing created source
|
||||||
if (priv->source != NULL)
|
if (priv->source != NULL)
|
||||||
{
|
g_clear_object (&priv->source);
|
||||||
g_object_unref (priv->source);
|
|
||||||
priv->source = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cleanup detected remote sources that weren't added
|
// Cleanup detected remote sources that weren't added
|
||||||
if (priv->remote_sources != NULL)
|
if (priv->remote_sources != NULL)
|
||||||
@@ -757,8 +753,7 @@ response_signal (GtkDialog *dialog,
|
|||||||
{
|
{
|
||||||
gcal_manager_save_source (priv->manager, priv->source);
|
gcal_manager_save_source (priv->manager, priv->source);
|
||||||
|
|
||||||
g_object_unref (priv->source);
|
g_clear_object (&priv->source);
|
||||||
priv->source = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* commit the new source */
|
/* commit the new source */
|
||||||
|
|||||||
Reference in New Issue
Block a user