[gnome-photos/wip/rishi/edit-mode: 8/33] 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: 8/33] base-item: Create the GEGL graph from the main thread
- Date: Wed, 11 Nov 2015 18:42:32 +0000 (UTC)
commit f9bf8e16fedb16af8bb13f7ac31bf3dc58f849f3
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 11616ae..9550b6f 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;
@@ -739,17 +740,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);
@@ -1398,10 +1396,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_source_tag (task, photos_base_item_load_async);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]