[gnome-photos/wip/rishi/misc-fixes: 3/17] pipeline: Transparently handle deserialization errors



commit c1028176689ae3636ce2754f794439a6c1b6b6f7
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Dec 28 17:37:51 2015 +0100

    pipeline: Transparently handle deserialization errors
    
    We already handle cases where there is nothing to restore from, so it
    seems reasonable to handle deserialization errors too.

 src/photos-pipeline.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/photos-pipeline.c b/src/photos-pipeline.c
index 087b126..6c04bf4 100644
--- a/src/photos-pipeline.c
+++ b/src/photos-pipeline.c
@@ -245,9 +245,6 @@ photos_pipeline_async_initable_init_load_contents (GObject *source_object, GAsyn
         }
     }
 
-  parent = gegl_node_get_parent (self->graph);
-  g_clear_object (&self->graph);
-
   /* HACK: This graph is busted. eg., the input and output proxies
    * point to the same GeglNode. I can't imagine this to be
    * anything else other than a GEGL bug.
@@ -258,10 +255,17 @@ photos_pipeline_async_initable_init_load_contents (GObject *source_object, GAsyn
   graph = gegl_node_new_from_xml (contents, "/");
   if (graph == NULL)
     {
-      g_task_return_new_error (task, PHOTOS_ERROR, 0, "Failed to deserialize from XML");
-      goto out;
+      gchar *uri;
+
+      uri = g_file_get_uri (file);
+      g_warning ("Unable to deserialize from %s", uri);
+      g_free (uri);
+      goto carry_on;
     }
 
+  parent = gegl_node_get_parent (self->graph);
+  g_clear_object (&self->graph);
+
   self->graph = gegl_node_new ();
   if (parent != NULL)
     gegl_node_add_child (parent, self->graph);


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