diff options
author | Mayank Sharma <mayank8019@gmail.com> | 2019-07-18 01:18:43 +0530 |
---|---|---|
committer | Ondrej Holy <oholy@redhat.com> | 2019-07-18 13:25:35 +0000 |
commit | 95511d5dbf15952aa4d9d05041997f5e100e576a (patch) | |
tree | 03fc45228d9c1037c5e420a636fd0dceff2e2bdb /daemon | |
parent | 12b238a38739d1bf01f021e448c6a1f5623f7e9b (diff) | |
download | gvfs-95511d5dbf15952aa4d9d05041997f5e100e576a.tar.gz |
google: Fix issue with stale entries remaining after rename operation
Currently, whenever we perform a rename operation, we set the `entry`'s
title to new display name, but at the time of removal of this entry from
cache, we still use the newer title. Hence, each time rename is done, a
single stale entry remains. This commit fixes the issue by reverting
back the title to the original display name of `entry` and then
performing a removal from cache.
Fixes: https://gitlab.gnome.org/GNOME/gvfs/issues/410
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/gvfsbackendgoogle.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/daemon/gvfsbackendgoogle.c b/daemon/gvfsbackendgoogle.c index 55c206d1..652b230f 100644 --- a/daemon/gvfsbackendgoogle.c +++ b/daemon/gvfsbackendgoogle.c @@ -2410,6 +2410,11 @@ g_vfs_backend_google_set_display_name (GVfsBackend *_self, goto out; } + /* The internal ref count has to be increased before removing the entry since + * remove_entry_full calls g_object_unref(). */ + g_object_ref (entry); + remove_entry (self, entry); + gdata_entry_set_title (entry, display_name); auth_domain = gdata_documents_service_get_primary_authorization_domain (); @@ -2420,14 +2425,15 @@ g_vfs_backend_google_set_display_name (GVfsBackend *_self, sanitize_error (&error); g_vfs_job_failed_from_error (G_VFS_JOB (job), error); g_error_free (error); + g_object_unref (entry); goto out; } - remove_entry (self, entry); insert_entry (self, new_entry); g_hash_table_foreach (self->monitors, emit_attribute_changed_event, entry_path); g_vfs_job_set_display_name_set_new_path (job, entry_path); g_vfs_job_succeeded (G_VFS_JOB (job)); + g_object_unref (entry); out: g_clear_object (&new_entry); |