From f7ede2b9df2962887b377c4e034933dc587813cd Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Sat, 20 Dec 2025 06:06:05 +0100 Subject: [PATCH] plugins: Disk Tidy: wait for dircache Running Disk Tidy while the dircache is loading is a lot slower than waiting for it to finish building first. Typical scenarios for this would be starting Disk Tidy immediately after booting or after unplugging from USB. Deleting files during a dircache build also seems to easily result in memory corruption, as evidenced by visual glitches appearing in the theme. Change-Id: I9250d918d916b112ffe2504a9225a0b52bcc3622 --- apps/plugin.c | 3 +++ apps/plugin.h | 3 +++ apps/plugins/disktidy.c | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/apps/plugin.c b/apps/plugin.c index 5058bdf7bf..cb319ab073 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -871,6 +871,9 @@ static const struct plugin_api rockbox_api = { #endif strstr, sb_set_title_text, +#ifdef HAVE_DIRCACHE + dircache_wait, +#endif }; static int plugin_buffer_handle; diff --git a/apps/plugin.h b/apps/plugin.h index 29dfebe583..51466cc70a 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -1022,6 +1022,9 @@ struct plugin_api { #endif char* (*strstr)(const char *s1, const char *s2); bool (*sb_set_title_text)(const char* title, enum themable_icons icon, enum screen_type screen); +#ifdef HAVE_DIRCACHE + void (*dircache_wait)(void); +#endif }; /* plugin header */ diff --git a/apps/plugins/disktidy.c b/apps/plugins/disktidy.c index 72b3c8d5d9..258ba95217 100644 --- a/apps/plugins/disktidy.c +++ b/apps/plugins/disktidy.c @@ -734,6 +734,10 @@ static enum plugin_status tidy_lcd_menu(void) switch(rb->do_menu(&menu, &selection, NULL, false)) { case 0: if (tidy_types_selected()) { +#ifdef HAVE_DIRCACHE + rb->splash(0, ID2P(LANG_WAIT)); + rb->dircache_wait(); +#endif disktidy_status = tidy_do(); if (disktidy_status == PLUGIN_OK) disktidy_status = display_run_stats();