Commit 665a2634 authored by Debarshi Ray's avatar Debarshi Ray

Use g_clear_object wherever applicable

parent 7f5d856f
......@@ -183,17 +183,8 @@ photos_application_dispose (GObject *object)
priv->resource = NULL;
}
if (priv->fs_action != NULL)
{
g_object_unref (priv->fs_action);
priv->fs_action = NULL;
}
if (priv->mode_cntrlr != NULL)
{
g_object_unref (priv->mode_cntrlr);
priv->mode_cntrlr = NULL;
}
g_clear_object (&priv->fs_action);
g_clear_object (&priv->mode_cntrlr);
G_OBJECT_CLASS (photos_application_parent_class)
->dispose (object);
......
......@@ -60,8 +60,7 @@ photos_base_manager_default_set_active_object (PhotosBaseManager *self, GObject
if (object == priv->active_object)
return FALSE;
if (priv->active_object != NULL)
g_object_unref (priv->active_object);
g_clear_object (&priv->active_object);
if (object != NULL)
g_object_ref (object);
......
......@@ -293,13 +293,7 @@ photos_embed_dispose (GObject *object)
g_clear_object (&priv->loader_cancellable);
g_clear_object (&priv->indexing_ntfctn);
g_clear_object (&priv->item_mngr);
if (priv->mode_cntrlr != NULL)
{
g_object_unref (priv->mode_cntrlr);
priv->mode_cntrlr = NULL;
}
g_clear_object (&priv->mode_cntrlr);
g_clear_object (&priv->offset_cntrlr);
g_clear_object (&priv->monitor);
g_clear_object (&priv->trk_cntrlr);
......
......@@ -353,18 +353,8 @@ photos_main_toolbar_dispose (GObject *object)
g_clear_object (&priv->col_mngr);
g_clear_object (&priv->item_mngr);
g_clear_object (&priv->src_mngr);
if (priv->mode_cntrlr != NULL)
{
g_object_unref (priv->mode_cntrlr);
priv->mode_cntrlr = NULL;
}
if (priv->sel_cntrlr != NULL)
{
g_object_unref (priv->sel_cntrlr);
priv->sel_cntrlr = NULL;
}
g_clear_object (&priv->mode_cntrlr);
g_clear_object (&priv->sel_cntrlr);
G_OBJECT_CLASS (photos_main_toolbar_parent_class)->dispose (object);
}
......
......@@ -231,12 +231,7 @@ photos_main_window_dispose (GObject *object)
g_clear_object (&priv->settings);
g_clear_object (&priv->item_mngr);
if (priv->controller != NULL)
{
g_object_unref (priv->controller);
priv->controller = NULL;
}
g_clear_object (&priv->controller);
if (priv->configure_id != 0)
{
......
......@@ -59,11 +59,7 @@ photos_organize_collection_model_dispose (GObject *object)
PhotosOrganizeCollectionModel *self = PHOTOS_ORGANIZE_COLLECTION_MODEL (object);
PhotosOrganizeCollectionModelPrivate *priv = self->priv;
if (priv->manager != NULL)
{
g_object_unref (priv->manager);
priv->manager = NULL;
}
g_clear_object (&priv->manager);
G_OBJECT_CLASS (photos_organize_collection_model_parent_class)->dispose (object);
}
......
......@@ -112,11 +112,7 @@ photos_organize_collection_view_dispose (GObject *object)
PhotosOrganizeCollectionView *self = PHOTOS_ORGANIZE_COLLECTION_VIEW (object);
PhotosOrganizeCollectionViewPrivate *priv = self->priv;
if (priv->model != NULL)
{
g_object_unref (priv->model);
priv->model = NULL;
}
g_clear_object (&priv->model);
G_OBJECT_CLASS (photos_organize_collection_view_parent_class)->dispose (object);
}
......
......@@ -53,8 +53,7 @@ photos_query_new (gchar *sparql)
void
photos_query_free (PhotosQuery *query)
{
if (query->source != NULL)
g_object_unref (query->source);
g_clear_object (&query->source);
g_free (query->sparql);
g_slice_free (PhotosQuery, query);
}
......@@ -456,12 +456,7 @@ photos_selection_toolbar_dispose (GObject *object)
}
g_clear_object (&priv->item_mngr);
if (priv->sel_cntrlr != NULL)
{
g_object_unref (priv->sel_cntrlr);
priv->sel_cntrlr = NULL;
}
g_clear_object (&priv->sel_cntrlr);
G_OBJECT_CLASS (photos_selection_toolbar_parent_class)->dispose (object);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment