[gnome-photos] tracker-controller: Be robust against PhotosTrackerQueue failures



commit 114300febe82bfd3b6a317cd96bb568e3893c59e
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Dec 30 13:31:52 2013 +0100

    tracker-controller: Be robust against PhotosTrackerQueue failures
    
    Fixes: https://bugzilla.gnome.org/704947

 src/photos-tracker-controller.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/photos-tracker-controller.c b/src/photos-tracker-controller.c
index 03c24ae..3b802cf 100644
--- a/src/photos-tracker-controller.c
+++ b/src/photos-tracker-controller.c
@@ -40,6 +40,7 @@
 struct _PhotosTrackerControllerPrivate
 {
   GCancellable *cancellable;
+  GError *queue_error;
   PhotosBaseManager *col_mngr;
   PhotosBaseManager *item_mngr;
   PhotosBaseManager *src_mngr;
@@ -173,6 +174,12 @@ photos_tracker_controller_perform_current_query (PhotosTrackerController *self)
   priv->current_query = PHOTOS_TRACKER_CONTROLLER_GET_CLASS (self)->get_query (self);
   g_cancellable_reset (priv->cancellable);
 
+  if (G_UNLIKELY (priv->queue == NULL))
+    {
+      photos_tracker_controller_query_error (self, priv->queue_error);
+      return;
+    }
+
   photos_tracker_queue_select (priv->queue,
                                priv->current_query->sparql,
                                priv->cancellable,
@@ -302,6 +309,8 @@ photos_tracker_controller_finalize (GObject *object)
   PhotosTrackerController *self = PHOTOS_TRACKER_CONTROLLER (object);
   PhotosTrackerControllerPrivate *priv = self->priv;
 
+  g_clear_error (&priv->queue_error);
+
   if (priv->current_query != NULL)
     photos_query_free (priv->current_query);
 
@@ -340,7 +349,7 @@ photos_tracker_controller_init (PhotosTrackerController *self)
                     G_CALLBACK (photos_tracker_controller_refresh_for_object),
                     self);
 
-  priv->queue = photos_tracker_queue_dup_singleton (NULL, NULL);
+  priv->queue = photos_tracker_queue_dup_singleton (NULL, &priv->queue_error);
 }
 
 


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