From 72c539d35e1853980de1d74e65acc9a22caa63f6 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Wed, 22 Nov 2023 00:07:30 -0500 Subject: [Bug_Fix] shortcut to directory in .link files caused crash since the plugin browser is now closed when running plugins rb->set_current_file() had no valid browser context and used 'random' memory instead also adds a way to discard levels so we can load the desired directory instead of returning to the previous https://forums.rockbox.org/index.php/topic,54694.0.html Change-Id: I624246e56d42972bf6a1ce566a209b745de6f30b --- apps/filetree.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'apps/filetree.c') diff --git a/apps/filetree.c b/apps/filetree.c index 42f13f39e7..eb429c83e3 100644 --- a/apps/filetree.c +++ b/apps/filetree.c @@ -287,12 +287,18 @@ static int compare(const void* p1, const void* p2) /* load and sort directory into the tree's cache. returns NULL on failure. */ int ft_load(struct tree_context* c, const char* tempdir) { + if (c->out_of_tree > 0) /* something else is loaded */ + return 0; + int files_in_dir = 0; int name_buffer_used = 0; struct dirent *entry; bool (*callback_show_item)(char *, int, struct tree_context *) = NULL; DIR *dir; + if (!c->is_browsing) + c->browse = NULL; + if (tempdir) dir = opendir(tempdir); else @@ -760,6 +766,7 @@ int ft_enter(struct tree_context* c) } } } + return rc; } @@ -802,5 +809,7 @@ int ft_exit(struct tree_context* c) if (exit_func) rc = 3; + c->out_of_tree = 0; + return rc; } -- cgit v1.2.3