mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
[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
This commit is contained in:
parent
2b7b4c24d5
commit
188f025f51
2 changed files with 8 additions and 3 deletions
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -1005,7 +1005,7 @@ static int dirbrowse(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return GO_TO_ROOT;
|
||||
}
|
||||
|
||||
int create_playlist(void)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue