Skip to content

Commit 80d7330

Browse files
zoltanvbLibretroAdmin
authored andcommitted
Fix for XMB menu freeze when scan button pushed twice in file explorer
Scanning needs to follow up potentially added playlists by an extra menu refresh. When scanning was invoked from file browser under XMB, by pushing retropad-y, second scanning followup would get lost as the logic is brittle, resulting in an unresponsive menu. The extra menu refresh is now combined with the regular scan task.
1 parent 146acd5 commit 80d7330

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

menu/cbs/menu_cbs_ok.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1991,13 +1991,6 @@ static bool menu_content_find_first_core(
19911991
return true;
19921992
}
19931993

1994-
#ifdef HAVE_LIBRETRODB
1995-
void handle_dbscan_finished(retro_task_t *task,
1996-
void *task_data, void *user_data, const char *err);
1997-
#endif
1998-
1999-
2000-
20011994
static int file_load_with_detect_core_wrapper(
20021995
enum msg_hash_enums enum_label_idx,
20031996
size_t idx, size_t entry_idx,
@@ -8456,7 +8449,7 @@ static int action_ok_manual_content_scan_start(const char *path,
84568449
settings->bools.playlist_portable_paths ?
84578450
settings->paths.directory_menu_content : NULL);
84588451

8459-
task_push_manual_content_scan(&playlist_config, directory_playlist);
8452+
task_push_manual_content_scan(true);
84608453
return 0;
84618454
}
84628455

@@ -9031,8 +9024,7 @@ static int action_ok_playlist_refresh(const char *path,
90319024
settings->bools.playlist_portable_paths ?
90329025
settings->paths.directory_menu_content : NULL);
90339026

9034-
task_push_manual_content_scan(playlist_config,
9035-
settings->paths.directory_playlist);
9027+
task_push_manual_content_scan(true);
90369028
}
90379029
return 0;
90389030
}

tasks/task_database.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ enum db_flags_enum
191191
DB_HANDLE_FLAG_SCAN_STARTED = (1 << 1),
192192
DB_HANDLE_FLAG_SCAN_WITHOUT_CORE_MATCH = (1 << 2),
193193
DB_HANDLE_FLAG_SHOW_HIDDEN_FILES = (1 << 3),
194-
DB_HANDLE_FLAG_USE_FIRST_MATCH_ONLY = (1 << 4)
194+
DB_HANDLE_FLAG_USE_FIRST_MATCH_ONLY = (1 << 4),
195+
DB_HANDLE_FLAG_DO_MENU_REFRESH = (1 << 5)
195196
};
196197

197198
enum manual_scan_status
@@ -1651,7 +1652,7 @@ bool task_push_dbscan(
16511652
{
16521653
manual_content_scan_set_menu_content_dir(fullpath);
16531654
/*manual_content_scan_set_menu_scan_method(MANUAL_CONTENT_SCAN_METHOD_AUTOMATIC);*/
1654-
return task_push_manual_content_scan(NULL,NULL);
1655+
return task_push_manual_content_scan(false);
16551656
}
16561657

16571658
#endif
@@ -1784,7 +1785,12 @@ static void cb_task_manual_content_scan(
17841785
end:
17851786
/* When creating playlists, the playlist tabs of
17861787
* any active menu driver must be refreshed */
1787-
if (menu_st->driver_ctx->environ_cb)
1788+
if (
1789+
#ifdef HAVE_LIBRETRODB
1790+
(!manual_scan ||
1791+
(manual_scan->flags & DB_HANDLE_FLAG_DO_MENU_REFRESH)) &&
1792+
#endif
1793+
menu_st->driver_ctx->environ_cb)
17881794
menu_st->driver_ctx->environ_cb(MENU_ENVIRON_RESET_HORIZONTAL_LIST,
17891795
NULL, menu_st->userdata);
17901796
#endif
@@ -2442,8 +2448,7 @@ static bool task_manual_content_scan_finder(retro_task_t *task, void *user_data)
24422448
}
24432449

24442450
bool task_push_manual_content_scan(
2445-
const playlist_config_t *playlist_config,
2446-
const char *playlist_directory)
2451+
bool do_menu_refresh)
24472452
{
24482453
size_t _len;
24492454
task_finder_data_t find_data;
@@ -2491,6 +2496,9 @@ bool task_push_manual_content_scan(
24912496
if (settings->bools.show_hidden_files)
24922497
manual_scan->flags |= DB_HANDLE_FLAG_SHOW_HIDDEN_FILES;
24932498

2499+
if (do_menu_refresh)
2500+
manual_scan->flags |= DB_HANDLE_FLAG_DO_MENU_REFRESH;
2501+
24942502
manual_scan->content_database_path = strdup(settings->paths.path_content_database);
24952503
#endif
24962504
manual_scan->playlist_directory = strdup(playlist_dir);

tasks/tasks_internal.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,7 @@ bool task_push_dbscan(
193193
#endif
194194

195195
bool task_push_manual_content_scan(
196-
const playlist_config_t *playlist_config,
197-
const char *playlist_directory);
196+
bool do_menu_refresh);
198197

199198
#ifdef HAVE_OVERLAY
200199
bool task_push_overlay_load_default(

0 commit comments

Comments
 (0)