[gvfs] mtp: make remove_cache_entry_by_id() remove all matching entries, not just the first one



commit 7ebbf005fb52f3b2fe362fbf297ca1557b8c09d8
Author: Rok Mandeljc <rok mandeljc gmail com>
Date:   Mon Jul 28 20:59:17 2014 +0200

    mtp: make remove_cache_entry_by_id() remove all matching entries, not just the first one
    
    With the recently added on-demand post-fixing of storage names,
    corner cases can occur in which we end up with multiple cache
    entries that have the same storage id and item id, but different
    paths.
    
    In particular, this happens upon change of post-fixing requirement,
    i.e., when a second storage that has same description as the first
    one is either added or removed. In such cases, the contents of the
    first storage might end up with two sets of cache entries, one where
    storage name is post-fixed and one is not. If afterwards an
    OBJECT_REMOVED event is received, only the first cache entry is
    removed, which may or may not cause Nautilus to correctly remove
    the file/folder.
    
    Signed-off-by: Rok Mandeljc <rok mandeljc gmail com>

 daemon/gvfsbackendmtp.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/daemon/gvfsbackendmtp.c b/daemon/gvfsbackendmtp.c
index 9148dd4..bb6c408 100644
--- a/daemon/gvfsbackendmtp.c
+++ b/daemon/gvfsbackendmtp.c
@@ -359,7 +359,10 @@ remove_cache_entry_by_id (GVfsBackendMtp *backend,
                             emit_delete_event,
                             (char *)path);
       g_hash_table_iter_remove (&iter);
-      break;
+
+      /* We do not break here because we can end up with multiple entries
+         that have same storage/object ID, and we should find and remove
+         them all instead of just the first one (Bug #733886) */
     }
   }
 


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