summaryrefslogtreecommitdiff
path: root/apps/filetree.c
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2023-11-22 00:07:30 -0500
committerWilliam Wilgus <wilgus.william@gmail.com>2023-11-22 00:52:58 -0500
commit72c539d35e1853980de1d74e65acc9a22caa63f6 (patch)
tree34c70c631addcd7dac99c294a1316391ef3e22c8 /apps/filetree.c
parent6e90bfe029fc69ad5a3b0e34b60b8a50f9105c2c (diff)
downloadrockbox-72c539d35e1853980de1d74e65acc9a22caa63f6.tar.gz
rockbox-72c539d35e1853980de1d74e65acc9a22caa63f6.zip
[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
Diffstat (limited to 'apps/filetree.c')
-rw-r--r--apps/filetree.c9
1 files changed, 9 insertions, 0 deletions
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)
287/* load and sort directory into the tree's cache. returns NULL on failure. */ 287/* load and sort directory into the tree's cache. returns NULL on failure. */
288int ft_load(struct tree_context* c, const char* tempdir) 288int ft_load(struct tree_context* c, const char* tempdir)
289{ 289{
290 if (c->out_of_tree > 0) /* something else is loaded */
291 return 0;
292
290 int files_in_dir = 0; 293 int files_in_dir = 0;
291 int name_buffer_used = 0; 294 int name_buffer_used = 0;
292 struct dirent *entry; 295 struct dirent *entry;
293 bool (*callback_show_item)(char *, int, struct tree_context *) = NULL; 296 bool (*callback_show_item)(char *, int, struct tree_context *) = NULL;
294 DIR *dir; 297 DIR *dir;
295 298
299 if (!c->is_browsing)
300 c->browse = NULL;
301
296 if (tempdir) 302 if (tempdir)
297 dir = opendir(tempdir); 303 dir = opendir(tempdir);
298 else 304 else
@@ -760,6 +766,7 @@ int ft_enter(struct tree_context* c)
760 } 766 }
761 } 767 }
762 } 768 }
769
763 return rc; 770 return rc;
764} 771}
765 772
@@ -802,5 +809,7 @@ int ft_exit(struct tree_context* c)
802 if (exit_func) 809 if (exit_func)
803 rc = 3; 810 rc = 3;
804 811
812 c->out_of_tree = 0;
813
805 return rc; 814 return rc;
806} 815}