1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Rafaël Carré 2010-07-10 02:46:08 +00:00
parent 2f271ac54a
commit 1edfe3fd47
3 changed files with 141 additions and 113 deletions

View file

@ -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
@ -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)