From 1edfe3fd473ebd336a8f9738d9199fd371245942 Mon Sep 17 00:00:00 2001 From: Rafaël Carré Date: Sat, 10 Jul 2010 02:46:08 +0000 Subject: SDL enhancements: - remove infinite loop after exit() - make sure picture_surface is initialized, and free it - split gui_message_loop() in 3 functions and change prototype - some code is only used in simulator git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27366 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/hosted/sdl/system-sdl.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'firmware/target/hosted/sdl/system-sdl.c') diff --git a/firmware/target/hosted/sdl/system-sdl.c b/firmware/target/hosted/sdl/system-sdl.c index ff4fe6570e..6937c373e3 100644 --- a/firmware/target/hosted/sdl/system-sdl.c +++ b/firmware/target/hosted/sdl/system-sdl.c @@ -26,6 +26,7 @@ #include #include "system.h" #include "thread-sdl.h" +#include "system-sdl.h" #include "sim-ui-defines.h" #include "lcd-sdl.h" #ifdef HAVE_LCD_BITMAP @@ -68,10 +69,6 @@ void sys_poweroff(void) { } -/* - * Button read loop */ -bool gui_message_loop(void); - /* * This thread will read the buttons in an interrupt like fashion, and * also initializes SDL_INIT_VIDEO and the surfaces @@ -85,7 +82,7 @@ static int sdl_event_thread(void * param) { SDL_InitSubSystem(SDL_INIT_VIDEO); - SDL_Surface *picture_surface; + SDL_Surface *picture_surface = NULL; int width, height; /* Try and load the background image. If it fails go without */ @@ -134,7 +131,10 @@ static int sdl_event_thread(void * param) /* * finally enter the button loop */ - while(gui_message_loop()); + gui_message_loop(); + + if(picture_surface) + SDL_FreeSurface(picture_surface); /* Order here is relevent to prevent deadlocks and use of destroyed sync primitives by kernel threads */ @@ -151,7 +151,6 @@ void sim_do_exit(void) SDL_Quit(); exit(EXIT_SUCCESS); - while(1); } void system_init(void) -- cgit v1.2.3