[gnome-photos/gnome-3-24] base-item: Process the graph after a revert only if the item is loaded



commit 1b7e451ca334f1f6a3bcd3f16f1fd7aec61e1cad
Author: Debarshi Ray <debarshir gnome org>
Date:   Sat Sep 23 00:09:57 2017 +0200

    base-item: Process the graph after a revert only if the item is loaded
    
    Commit 8047f788f51cc551 decoupled the loading of the Pipeline from the
    rest of the BaseItem. The presence of a pipeline doesn't imply the
    existence of a buffer source, edit graph, etc..
    
    Therefore, discarding all edits from the overview, without loading the
    BaseItem, would lead to processing a GEGL graph without any input and:
      GEGL-WARNING **: Output of gegl:nop 'proxynop-output' 0x7f741c026900
        has no format
    
    Processing a BaseItem after changing its Pipeline is only necessary if
    the rest of the BaseItem is loaded. Hence it is better to just skip it
    in this case.
    
    Note that the thumbnail is updated when the Pipeline is saved, which
    also doesn't require loading the BaseItem. The thumbnailer takes care
    of that.
    
    Fallout from 8047f788f51cc551e57b012372455154eb57f739
    
    https://bugzilla.gnome.org/show_bug.cgi?id=788715

 src/photos-base-item.c |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 087ec1d..9373957 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -4019,7 +4019,7 @@ photos_base_item_pipeline_revert_async (PhotosBaseItem *self,
                                         gpointer user_data)
 {
   PhotosBaseItemPrivate *priv;
-  GTask *task;
+  GTask *task = NULL;
   PhotosPipeline *pipeline;
 
   g_return_if_fail (PHOTOS_IS_BASE_ITEM (self));
@@ -4035,9 +4035,16 @@ photos_base_item_pipeline_revert_async (PhotosBaseItem *self,
   task = g_task_new (self, cancellable, callback, user_data);
   g_task_set_source_tag (task, photos_base_item_pipeline_revert_async);
 
+  if (priv->edit_graph == NULL)
+    {
+      g_task_return_boolean (task, TRUE);
+      goto out;
+    }
+
   photos_base_item_process_async (self, cancellable, photos_base_item_common_process, g_object_ref (task));
 
-  g_object_unref (task);
+ out:
+  g_clear_object (&task);
 }
 
 
@@ -4063,7 +4070,7 @@ photos_base_item_pipeline_revert_to_original_async (PhotosBaseItem *self,
 
 {
   PhotosBaseItemPrivate *priv;
-  GTask *task;
+  GTask *task = NULL;
   PhotosPipeline *pipeline;
 
   g_return_if_fail (PHOTOS_IS_BASE_ITEM (self));
@@ -4079,9 +4086,16 @@ photos_base_item_pipeline_revert_to_original_async (PhotosBaseItem *self,
   task = g_task_new (self, cancellable, callback, user_data);
   g_task_set_source_tag (task, photos_base_item_pipeline_revert_to_original_async);
 
+  if (priv->edit_graph == NULL)
+    {
+      g_task_return_boolean (task, TRUE);
+      goto out;
+    }
+
   photos_base_item_process_async (self, cancellable, photos_base_item_common_process, g_object_ref (task));
 
-  g_object_unref (task);
+ out:
+  g_clear_object (&task);
 }
 
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]