Add a "early_usb" argument to gui_usb_screen_run(), and don't do skin unloading/reloading in gui_usb_screen_run() in the early usb case. Fixes the crash part of FS#11589

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28229 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Frank Gevaerts 2010-10-10 13:17:39 +00:00
parent 0d100b4dd8
commit c8c40c5291
5 changed files with 28 additions and 21 deletions

View file

@ -78,7 +78,7 @@ static void skin_render_playlistviewer(struct playlistviewer* viewer,
unsigned long refresh_type);
#endif
static bool do_non_text_tags(struct gui_wps *gwps, struct skin_draw_info *info,
static __attribute__((noinline)) bool do_non_text_tags(struct gui_wps *gwps, struct skin_draw_info *info,
struct skin_element *element, struct viewport* vp)
{
#ifndef HAVE_LCD_BITMAP
@ -234,7 +234,7 @@ static bool do_non_text_tags(struct gui_wps *gwps, struct skin_draw_info *info,
static void do_tags_in_hidden_conditional(struct skin_element* branch,
static __attribute__((noinline)) void do_tags_in_hidden_conditional(struct skin_element* branch,
struct skin_draw_info *info)
{
#ifdef HAVE_LCD_BITMAP
@ -328,7 +328,7 @@ static void do_tags_in_hidden_conditional(struct skin_element* branch,
}
}
static void fix_line_alignment(struct skin_draw_info *info, struct skin_element *element)
static __attribute__((noinline)) void fix_line_alignment(struct skin_draw_info *info, struct skin_element *element)
{
struct align_pos *align = &info->align;
char *cur_pos = info->cur_align_start + strlen(info->cur_align_start);
@ -371,7 +371,7 @@ static void fix_line_alignment(struct skin_draw_info *info, struct skin_element
}
/* Draw a LINE element onto the display */
static bool skin_render_line(struct skin_element* line, struct skin_draw_info *info)
static __attribute__((noinline)) bool skin_render_line(struct skin_element* line, struct skin_draw_info *info)
{
bool needs_update = false;
int last_value, value;
@ -478,7 +478,7 @@ static bool skin_render_line(struct skin_element* line, struct skin_draw_info *i
return needs_update;
}
static int get_subline_timeout(struct gui_wps *gwps, struct skin_element* line)
static __attribute__((noinline)) int get_subline_timeout(struct gui_wps *gwps, struct skin_element* line)
{
struct skin_element *element=line;
struct wps_token *token;
@ -514,7 +514,7 @@ static int get_subline_timeout(struct gui_wps *gwps, struct skin_element* line)
return retval;
}
bool skin_render_alternator(struct skin_element* element, struct skin_draw_info *info)
bool __attribute__((noinline)) skin_render_alternator(struct skin_element* element, struct skin_draw_info *info)
{
bool changed_lines = false;
struct line_alternator *alternator = (struct line_alternator*)element->data;
@ -570,7 +570,7 @@ bool skin_render_alternator(struct skin_element* element, struct skin_draw_info
return changed_lines || ret;
}
static void skin_render_viewport(struct skin_element* viewport, struct gui_wps *gwps,
static __attribute__((noinline)) void skin_render_viewport(struct skin_element* viewport, struct gui_wps *gwps,
struct skin_viewport* skin_viewport, unsigned long refresh_type)
{
struct screen *display = gwps->display;
@ -715,7 +715,7 @@ void skin_render(struct gui_wps *gwps, unsigned refresh_mode)
}
#ifdef HAVE_LCD_BITMAP
static void skin_render_playlistviewer(struct playlistviewer* viewer,
static __attribute__((noinline)) void skin_render_playlistviewer(struct playlistviewer* viewer,
struct gui_wps *gwps,
struct skin_viewport* skin_viewport,
unsigned long refresh_type)

View file

@ -241,7 +241,7 @@ static void usb_screens_draw(struct usb_screen_vps_t *usb_screen_vps_ar)
}
}
void gui_usb_screen_run(void)
void gui_usb_screen_run(bool early_usb)
{
int i;
struct usb_screen_vps_t usb_screen_vps_ar[NB_SCREENS];
@ -262,14 +262,18 @@ void gui_usb_screen_run(void)
usb_keypad_mode = global_settings.usb_keypad_mode;
#endif
/* The font system leaves the .fnt fd's open, so we need for force close them all */
if(!early_usb)
{
/* The font system leaves the .fnt fd's open, so we need for force close them all */
#ifdef HAVE_LCD_BITMAP
font_reset(NULL);
font_reset(NULL);
#ifdef HAVE_REMOTE_LCD
font_load_remoteui(NULL);
font_load_remoteui(NULL);
#endif
skin_font_init(); /* unload all the skin fonts */
skin_font_init(); /* unload all the skin fonts */
#endif
}
FOR_NB_SCREENS(i)
{
struct screen *screen = &screens[i];
@ -324,9 +328,12 @@ void gui_usb_screen_run(void)
status_set_usb(false);
#endif /* HAVE_LCD_CHARCELLS */
#ifdef HAVE_LCD_BITMAP
/* Not pretty, reload all settings so fonts are loaded again correctly */
settings_apply(true);
settings_apply_skins();
if(!early_usb)
{
/* Not pretty, reload all settings so fonts are loaded again correctly */
settings_apply(true);
settings_apply_skins();
}
#endif
FOR_NB_SCREENS(i)

View file

@ -22,9 +22,9 @@
#define _USB_SCREEN_H_
#ifdef USB_NONE
static inline void gui_usb_screen_run(void) {}
static inline void gui_usb_screen_run(bool early_usb) {}
#else
extern void gui_usb_screen_run(void);
extern void gui_usb_screen_run(bool early_usb);
#endif
#endif

View file

@ -573,7 +573,7 @@ static void init(void)
(mmc_remove_request() == SYS_HOTSWAP_EXTRACTED))
#endif
{
gui_usb_screen_run();
gui_usb_screen_run(true);
mounted = true; /* mounting done @ end of USB mode */
}
#ifdef HAVE_USB_POWER
@ -600,7 +600,7 @@ static void init(void)
lcd_update();
while(button_get(true) != SYS_USB_CONNECTED) {};
gui_usb_screen_run();
gui_usb_screen_run(true);
system_reboot();
}
}

View file

@ -547,7 +547,7 @@ long default_event_handler_ex(long event, void (*callback)(void *), void *parame
check_bootfile(false); /* gets initial size */
#endif
#endif
gui_usb_screen_run();
gui_usb_screen_run(false);
#ifdef BOOTFILE
#if !defined(USB_NONE) && !defined(USB_HANDLED_BY_OF)
check_bootfile(true);