[gnome-photos/wip/rishi/edit-mode: 7/25] base-item: Create the GEGL graph from the main thread
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/edit-mode: 7/25] base-item: Create the GEGL graph from the main thread
- Date: Sun, 28 Jun 2015 08:16:34 +0000 (UTC)
commit 2a68fac17ac0e5550ce83b750f9391e3e3b1ca1a
Author: Debarshi Ray <debarshir gnome org>
Date: Thu Jan 29 15:20:22 2015 +0100
base-item: Create the GEGL graph from the main thread
Creating and destroying the graph from different threads does not look
like a good idea. This has not caused us any issues so far, but it
might when the graph becomes less trivial. We can easily avoid this, so
why not?
src/photos-base-item.c | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 1ae667c..7c05186 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -68,6 +68,7 @@ struct _PhotosBaseItemPrivate
gboolean collection;
gboolean failed_thumbnailing;
gboolean favorite;
+ gboolean loaded_once;
const gchar *thumb_path;
gchar *author;
gchar *default_app_name;
@@ -732,17 +733,14 @@ photos_base_item_load (PhotosBaseItem *self, GCancellable *cancellable, GError *
GeglNode *ret_val = NULL;
gchar *path = NULL;
- if (priv->graph == NULL)
+ if (!priv->loaded_once)
{
path = photos_base_item_download (self, cancellable, error);
if (path == NULL)
goto out;
- priv->graph = gegl_node_new ();
- priv->node = gegl_node_new_child (priv->graph,
- "operation", "gegl:load",
- "path", path,
- NULL);
+ gegl_node_set (priv->node, "path", path, NULL);
+ priv->loaded_once = TRUE;
}
gegl_node_process (priv->node);
@@ -1392,10 +1390,17 @@ photos_base_item_load_async (PhotosBaseItem *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
+ PhotosBaseItemPrivate *priv = self->priv;
GTask *task;
g_return_if_fail (PHOTOS_IS_BASE_ITEM (self));
+ if (priv->graph == NULL)
+ {
+ priv->graph = gegl_node_new ();
+ priv->node = gegl_node_new_child (priv->graph, "operation", "gegl:load", NULL);
+ }
+
task = g_task_new (self, cancellable, callback, user_data);
g_task_set_check_cancellable (task, TRUE);
g_task_set_source_tag (task, photos_base_item_load_async);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]