[gnome-photos] base-item: Assert that certain operations need a pre-loaded pipeline



commit 716b9560405e2da7eaa4df447014e000cc52e0db
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Sep 22 23:52:19 2017 +0200

    base-item: Assert that certain operations need a pre-loaded pipeline
    
    https://bugzilla.gnome.org/show_bug.cgi?id=788715

 src/photos-base-item.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 1c5a5e6..f2610fb 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -1333,6 +1333,7 @@ photos_base_item_process_async (PhotosBaseItem *self,
   g_return_if_fail (!priv->collection);
 
   pipeline = PHOTOS_PIPELINE (egg_task_cache_peek (pipeline_cache, self));
+  g_return_if_fail (PHOTOS_IS_PIPELINE (pipeline));
 
   g_clear_object (&priv->processor);
   priv->processor = photos_pipeline_new_processor (pipeline);
@@ -1618,6 +1619,8 @@ photos_base_item_load_process (GObject *source_object, GAsyncResult *res, gpoint
     }
 
   pipeline = PHOTOS_PIPELINE (egg_task_cache_peek (pipeline_cache, self));
+  g_assert_true (PHOTOS_IS_PIPELINE (pipeline));
+
   graph = photos_pipeline_get_graph (pipeline);
   g_task_return_pointer (task, g_object_ref (graph), g_object_unref);
 
@@ -3866,6 +3869,7 @@ photos_base_item_operation_add_async (PhotosBaseItem *self,
   g_return_if_fail (!priv->collection);
 
   pipeline = PHOTOS_PIPELINE (egg_task_cache_peek (pipeline_cache, self));
+  g_return_if_fail (PHOTOS_IS_PIPELINE (pipeline));
 
   va_start (ap, first_property_name);
   photos_pipeline_add_valist (pipeline, operation, first_property_name, ap);
@@ -3908,6 +3912,7 @@ photos_base_item_operation_get (PhotosBaseItem *self, const gchar *operation, co
   g_return_val_if_fail (!priv->collection, FALSE);
 
   pipeline = PHOTOS_PIPELINE (egg_task_cache_peek (pipeline_cache, self));
+  g_return_val_if_fail (PHOTOS_IS_PIPELINE (pipeline), FALSE);
 
   va_start (ap, first_property_name);
   ret_val = photos_pipeline_get_valist (pipeline, operation, first_property_name, ap);
@@ -3933,10 +3938,12 @@ photos_base_item_operation_remove_async (PhotosBaseItem *self,
 
   g_return_if_fail (!priv->collection);
 
+  pipeline = PHOTOS_PIPELINE (egg_task_cache_peek (pipeline_cache, self));
+  g_return_if_fail (PHOTOS_IS_PIPELINE (pipeline));
+
   task = g_task_new (self, cancellable, callback, user_data);
   g_task_set_source_tag (task, photos_base_item_operation_remove_async);
 
-  pipeline = PHOTOS_PIPELINE (egg_task_cache_peek (pipeline_cache, self));
   if (!photos_pipeline_remove (pipeline, operation))
     {
       g_task_return_new_error (task, PHOTOS_ERROR, 0, "Failed to find a GeglNode for %s", operation);
@@ -4020,6 +4027,8 @@ photos_base_item_pipeline_revert_async (PhotosBaseItem *self,
   g_return_if_fail (!priv->collection);
 
   pipeline = PHOTOS_PIPELINE (egg_task_cache_peek (pipeline_cache, self));
+  g_return_if_fail (PHOTOS_IS_PIPELINE (pipeline));
+
   photos_pipeline_revert (pipeline);
 
   task = g_task_new (self, cancellable, callback, user_data);
@@ -4062,6 +4071,8 @@ photos_base_item_pipeline_revert_to_original_async (PhotosBaseItem *self,
   g_return_if_fail (!priv->collection);
 
   pipeline = PHOTOS_PIPELINE (egg_task_cache_peek (pipeline_cache, self));
+  g_return_if_fail (PHOTOS_IS_PIPELINE (pipeline));
+
   photos_pipeline_revert_to_original (pipeline);
 
   task = g_task_new (self, cancellable, callback, user_data);
@@ -4141,6 +4152,8 @@ photos_base_item_pipeline_snapshot (PhotosBaseItem *self)
   g_return_if_fail (!priv->collection);
 
   pipeline = PHOTOS_PIPELINE (egg_task_cache_peek (pipeline_cache, self));
+  g_return_if_fail (PHOTOS_IS_PIPELINE (pipeline));
+
   photos_pipeline_snapshot (pipeline);
 }
 


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