[gnome-photos/wip/rishi/edit-mode: 10/28] 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: 10/28] base-item: Create the GEGL graph from the main thread
- Date: Tue, 10 Nov 2015 09:47:11 +0000 (UTC)
commit 71dcbdb26e9420614b5cc671eebabda2a484a043
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 7c573a5..2d17a30 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]