From 0c12d3afcc571fcbee0d257e888985399b36b48b Mon Sep 17 00:00:00 2001 From: Ross Lagerwall Date: Thu, 11 Sep 2014 23:25:24 +0100 Subject: [PATCH] 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 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c index 3b92ca1329..8b545f5103 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); }