summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorAmaury Pouly <pamaury@rockbox.org>2010-05-21 08:31:11 +0000
committerAmaury Pouly <pamaury@rockbox.org>2010-05-21 08:31:11 +0000
commit7c205aa686a013de6648fb6e203e1c1ca17f3dd1 (patch)
treeca88826cf418aea9b12cd98f2263924fc1698a08 /firmware
parentdcbf4bbdeae394330b0e0f9bf27a9140dad48692 (diff)
downloadrockbox-7c205aa686a013de6648fb6e203e1c1ca17f3dd1.tar.gz
rockbox-7c205aa686a013de6648fb6e203e1c1ca17f3dd1.tar.bz2
rockbox-7c205aa686a013de6648fb6e203e1c1ca17f3dd1.zip
FS#10913: fix file browser not updated on microsd insertion/removal. This is a synchro bug in dircache: the system send a SYS_FS_CHANGED message which is first handled by the main thread which rescan the directory but as dircache main treats the message after, the file browser get the old version... Workaround is to check message queue before opening a directory.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26222 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/common/dircache.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/firmware/common/dircache.c b/firmware/common/dircache.c
index e642296a35..a50ebe8f30 100644
--- a/firmware/common/dircache.c
+++ b/firmware/common/dircache.c
@@ -1211,6 +1211,19 @@ void dircache_add_file(const char *path, long startcluster)
entry->startcluster = startcluster;
}
+/* Check if dircache state is still valid. With hotswap, on fs changed,
+ * the dircache became invalid but functions coulld be called befire the
+ * dircache thread process the message */
+static void check_dircache_state(void)
+{
+ if(check_event_queue())
+ {
+ /* Keep this coherent with check_event_queue(). Currently, all the
+ * messages that return true will lead to disable. */
+ dircache_initialized = false;
+ }
+}
+
DIR_CACHED* opendir_cached(const char* name)
{
int dd;
@@ -1235,6 +1248,8 @@ DIR_CACHED* opendir_cached(const char* name)
}
pdir->busy = true;
+ /* check real dircache state */
+ check_dircache_state();
if (!dircache_initialized)
{