summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2024-07-21 01:45:25 -0400
committerWilliam Wilgus <wilgus.william@gmail.com>2024-07-21 01:45:25 -0400
commit188f025f519bc99e51a20ea842df9898a461ca6d (patch)
tree93d3799b4e64326faf7c3b38b9b72a38f43e375f
parent2b7b4c24d50ccdaf0efcf2aafd6150c954a82c4c (diff)
downloadrockbox-188f025f51.tar.gz
rockbox-188f025f51.zip
[Bug Fix] Data Abort on Usb Unplug, database browser ran on USB dc
current_lists holds a pointer to whatver the current list is only problem is when in one of the function type menus like the plugin viewer, playlist viewer, shortcut menu probably a few others on usb unplug current_lists holds stale data and updates the list however the data has already been freed when the function returned the issue with db browser was a return of true from dirbrowse() which was the value 1 which is the enum for GO_TO_DBBROWSER Change-Id: I7349dfab2752e11f8e746925501740e959851cd5
-rw-r--r--apps/gui/list.c9
-rw-r--r--apps/tree.c2
2 files changed, 8 insertions, 3 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c
index 85046ead54..5368636896 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -51,6 +51,7 @@ void list_draw(struct screen *display, struct gui_synclist *list);
static long last_dirty_tick;
static struct viewport parent[NB_SCREENS];
+static struct gui_synclist *current_lists;
static bool list_is_dirty(struct gui_synclist *list)
{
@@ -59,8 +60,12 @@ static bool list_is_dirty(struct gui_synclist *list)
static void list_force_reinit(unsigned short id, void *param, void *last_dirty_tick)
{
- (void)id;
(void)param;
+ if (id == SYS_EVENT_USB_INSERTED) /* Disable the skin redraw callback -- Data may not be valid after USB unplug*/
+ {
+ current_lists = NULL;
+ return;
+ }
*(int *)last_dirty_tick = current_tick;
}
@@ -68,6 +73,7 @@ void list_init(void)
{
last_dirty_tick = current_tick;
add_event_ex(GUI_EVENT_THEME_CHANGED, false, list_force_reinit, &last_dirty_tick);
+ add_event_ex(SYS_EVENT_USB_INSERTED, false, list_force_reinit, NULL);
}
static void list_init_viewports(struct gui_synclist *list)
@@ -590,7 +596,6 @@ bool gui_synclist_keyclick_callback(int action, void* data)
* if something is using the list UI they *must* be calling those
* two functions in the correct order or the list wont work.
*/
-static struct gui_synclist *current_lists;
static bool ui_update_event_registered = false;
static void _lists_uiviewport_update_callback(unsigned short id, void *data)
{
diff --git a/apps/tree.c b/apps/tree.c
index d9d23d277a..938492b168 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -1005,7 +1005,7 @@ static int dirbrowse(void)
}
}
}
- return true;
+ return GO_TO_ROOT;
}
int create_playlist(void)