summaryrefslogtreecommitdiff
path: root/client/gvfsiconloadable.c
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2019-02-28 16:48:51 +0100
committerOndrej Holy <oholy@redhat.com>2019-03-04 12:33:47 +0100
commit23603b0315cd5c8c3226d1474b3dcdbc58cabc4a (patch)
treef43e56d727027bde8d7b478db95117e15749b9a0 /client/gvfsiconloadable.c
parent166e8b2b46d30294ede9f5a515026abc632371c5 (diff)
downloadgvfs-23603b0315cd5c8c3226d1474b3dcdbc58cabc4a.tar.gz
client: Fix mount info cache invalidation
Mount info cache invalidation is not handled properly and thus client can get "Cache invalid, retry (internally handled)" internal error, which should not be passed to the client. This can happen if mount was unmounted and another mount for the some location is mounted. This is now more common with introducing stable URIs for MTP backend. G_VFS_ERROR_RETRY error handling was probably lost as a consequence of GDBus port by commit 622a5c0d. Let's retry the operation internally again if G_VFS_ERROR_RETRY is returned. https://gitlab.gnome.org/GNOME/gvfs/merge_requests/30
Diffstat (limited to 'client/gvfsiconloadable.c')
-rw-r--r--client/gvfsiconloadable.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/client/gvfsiconloadable.c b/client/gvfsiconloadable.c
index 7a9bf97b..e6a0a8f4 100644
--- a/client/gvfsiconloadable.c
+++ b/client/gvfsiconloadable.c
@@ -44,18 +44,20 @@ create_proxy_for_icon (GVfsIcon *vfs_icon,
GVfsDBusMount *proxy;
GMountInfo *mount_info;
GDBusConnection *connection;
+ GError *local_error = NULL;
+ retry:
proxy = NULL;
mount_info = _g_daemon_vfs_get_mount_info_sync (vfs_icon->mount_spec,
"/",
cancellable,
- error);
+ &local_error);
if (mount_info == NULL)
goto out;
- connection = _g_dbus_connection_get_sync (mount_info->dbus_id, cancellable, error);
+ connection = _g_dbus_connection_get_sync (mount_info->dbus_id, cancellable, &local_error);
if (connection == NULL)
goto out;
@@ -64,14 +66,21 @@ create_proxy_for_icon (GVfsIcon *vfs_icon,
mount_info->dbus_id,
mount_info->object_path,
cancellable,
- error);
+ &local_error);
out:
if (mount_info)
g_mount_info_unref (mount_info);
- if (error && *error)
- g_dbus_error_strip_remote_error (*error);
+ if (local_error)
+ {
+ if (g_error_matches (local_error, G_VFS_ERROR, G_VFS_ERROR_RETRY))
+ {
+ g_clear_error (&local_error);
+ goto retry;
+ }
+ _g_propagate_error_stripped (error, local_error);
+ }
return proxy;
}