[gtk+] GtkPlacesSidebar: Don't update bookmark if cancelled



commit 0c12d3afcc571fcbee0d257e888985399b36b48b
Author: Ross Lagerwall <rosslagerwall gmail com>
Date:   Thu Sep 11 23:25:24 2014 +0100

    GtkPlacesSidebar: Don't update bookmark if cancelled
    
    If the query fails because it has been cancelled, it means that
    dispose() has been called, so don't try and update anything.
    
    This fixes a segfault with Nautilus in certain situations.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=736512

 gtk/gtkplacessidebar.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index 3b92ca1..8b545f5 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -838,13 +838,16 @@ on_bookmark_query_info_complete (GObject *source,
   BookmarkQueryClosure *clos = data;
   GtkPlacesSidebar *sidebar = clos->sidebar;
   GFile *root = G_FILE (source);
+  GError *error = NULL;
   GFileInfo *info;
   gchar *bookmark_name;
   gchar *mount_uri;
   gchar *tooltip;
   GIcon *icon;
 
-  info = g_file_query_info_finish (root, result, NULL);
+  info = g_file_query_info_finish (root, result, &error);
+  if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+    goto out;
 
   bookmark_name = _gtk_bookmarks_manager_get_bookmark_label (sidebar->bookmarks_manager, root);
   if (bookmark_name == NULL && info != NULL)
@@ -880,6 +883,7 @@ on_bookmark_query_info_complete (GObject *source,
 
 out:
   g_clear_object (&info);
+  g_clear_error (&error);
   g_slice_free (BookmarkQueryClosure, clos);
 }
 


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