[gnome-photos] Fix and clean-up reference counting
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] Fix and clean-up reference counting
- Date: Mon, 25 Mar 2013 15:54:31 +0000 (UTC)
commit fa27aa56111b6ab58720d787795fc1dc06c76a7f
Author: Debarshi Ray <debarshir gnome org>
Date: Sun Mar 24 16:26:05 2013 +0100
Fix and clean-up reference counting
src/photos-embed.c | 8 ++++++--
src/photos-preview-view.c | 4 +++-
2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/photos-embed.c b/src/photos-embed.c
index 8a9e817..2a1857f 100644
--- a/src/photos-embed.c
+++ b/src/photos-embed.c
@@ -89,7 +89,7 @@ photos_embed_item_load (GObject *source_object, GAsyncResult *res, gpointer user
g_clear_object (&priv->loader_cancellable);
node = photos_base_item_load_finish (item, res, NULL);
if (node == NULL)
- return;
+ goto out;
photos_preview_view_set_node (PHOTOS_PREVIEW_VIEW (priv->preview), node);
@@ -97,6 +97,10 @@ photos_embed_item_load (GObject *source_object, GAsyncResult *res, gpointer user
photos_mode_controller_set_window_mode (priv->mode_cntrlr, PHOTOS_WINDOW_MODE_PREVIEW);
photos_mode_controller_set_can_fullscreen (priv->mode_cntrlr, TRUE);
+
+ out:
+ g_clear_object (&node);
+ g_object_unref (self);
}
@@ -118,7 +122,7 @@ photos_embed_active_changed (PhotosBaseManager *manager, GObject *object, gpoint
photos_base_item_load_async (PHOTOS_BASE_ITEM (object),
priv->loader_cancellable,
photos_embed_item_load,
- self);
+ g_object_ref (self));
}
diff --git a/src/photos-preview-view.c b/src/photos-preview-view.c
index bc15a57..8c7815b 100644
--- a/src/photos-preview-view.c
+++ b/src/photos-preview-view.c
@@ -206,5 +206,7 @@ photos_preview_view_set_node (PhotosPreviewView *self, GeglNode *node)
priv->node = g_object_ref (node);
photos_preview_view_scale_and_align_image (self);
- gegl_gtk_view_set_node (GEGL_GTK_VIEW (priv->view), priv->node);
+
+ /* Steals the reference to the GeglNode. */
+ gegl_gtk_view_set_node (GEGL_GTK_VIEW (priv->view), g_object_ref (priv->node));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]