From 3957aa87205e8263384f7b50ed18c1df0de0b057 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Sat, 3 Dec 2022 05:08:09 -0500 Subject: [PATCH] RFC BugFix tagtree.c reload data abort TagNav.lua adds Reload to the Custom View menu of tagnav to allow users to make new search queries on the fly previously you had to reboot the device to do this I was getting a data abort prior to calling tagnav_init now but it worked fine if I copy pasted the contents of the init function I'm not sure how this fixed it but making a static init function makes it work as intended is it a race some weird thing with the compiler?? Ideas?? Change-Id: I7fd6c50f929d3ac2d9ecec5336942288e9213ad5 --- apps/tagtree.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/tagtree.c b/apps/tagtree.c index 8e7b868dbc..7887ee1c36 100644 --- a/apps/tagtree.c +++ b/apps/tagtree.c @@ -1248,7 +1248,7 @@ static void tagtree_unload(struct tree_context *c) tree_unlock_cache(c); } -void tagtree_init(void) +static bool initialize_tagtree(void) /* also used when user selects 'Reload' in 'custom view'*/ { max_history_level = 0; format_count = 0; @@ -1269,7 +1269,7 @@ void tagtree_init(void) if (!parse_menu(tagnavi_file)) { tagtree_unload(NULL); - return; + return false; } /* safety check since tree.c needs to cast tagentry to entry */ @@ -1286,6 +1286,12 @@ void tagtree_init(void) add_event(PLAYBACK_EVENT_TRACK_FINISH, tagtree_track_finish_event); core_shrink(tagtree_handle, core_get_data(tagtree_handle), tagtree_buf_used); + return true; +} + +void tagtree_init(void) +{ + initialize_tagtree(); } static bool show_search_progress(bool init, int count) @@ -1815,7 +1821,8 @@ int tagtree_load(struct tree_context* c) { splash(HZ, str(LANG_WAIT)); tagtree_unload(c); - tagtree_init(); + if (!initialize_tagtree()) + return 0; } c->dirlevel = 0; count = load_root(c);