summaryrefslogtreecommitdiffstats
path: root/firmware/target/hosted/sdl/system-sdl.c
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2010-07-10 02:46:08 +0000
committerRafaël Carré <rafael.carre@gmail.com>2010-07-10 02:46:08 +0000
commit1edfe3fd473ebd336a8f9738d9199fd371245942 (patch)
tree0c0bd144ace4d31cf40a539dc93ac2cb9b3f4cbc /firmware/target/hosted/sdl/system-sdl.c
parent2f271ac54af1f481bd30b9d37240e52dc31c0c0e (diff)
downloadrockbox-1edfe3fd473ebd336a8f9738d9199fd371245942.tar.gz
rockbox-1edfe3fd473ebd336a8f9738d9199fd371245942.zip
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
Diffstat (limited to 'firmware/target/hosted/sdl/system-sdl.c')
-rw-r--r--firmware/target/hosted/sdl/system-sdl.c13
1 files changed, 6 insertions, 7 deletions
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 <inttypes.h>
#include "system.h"
#include "thread-sdl.h"
+#include "system-sdl.h"
#include "sim-ui-defines.h"
#include "lcd-sdl.h"
#ifdef HAVE_LCD_BITMAP
@@ -69,10 +70,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)