summaryrefslogtreecommitdiff
path: root/firmware/target/hosted/sdl/system-sdl.c
diff options
context:
space:
mode:
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 @@
26#include <inttypes.h> 26#include <inttypes.h>
27#include "system.h" 27#include "system.h"
28#include "thread-sdl.h" 28#include "thread-sdl.h"
29#include "system-sdl.h"
29#include "sim-ui-defines.h" 30#include "sim-ui-defines.h"
30#include "lcd-sdl.h" 31#include "lcd-sdl.h"
31#ifdef HAVE_LCD_BITMAP 32#ifdef HAVE_LCD_BITMAP
@@ -69,10 +70,6 @@ void sys_poweroff(void)
69} 70}
70 71
71/* 72/*
72 * Button read loop */
73bool gui_message_loop(void);
74
75/*
76 * This thread will read the buttons in an interrupt like fashion, and 73 * This thread will read the buttons in an interrupt like fashion, and
77 * also initializes SDL_INIT_VIDEO and the surfaces 74 * also initializes SDL_INIT_VIDEO and the surfaces
78 * 75 *
@@ -85,7 +82,7 @@ static int sdl_event_thread(void * param)
85{ 82{
86 SDL_InitSubSystem(SDL_INIT_VIDEO); 83 SDL_InitSubSystem(SDL_INIT_VIDEO);
87 84
88 SDL_Surface *picture_surface; 85 SDL_Surface *picture_surface = NULL;
89 int width, height; 86 int width, height;
90 87
91 /* Try and load the background image. If it fails go without */ 88 /* Try and load the background image. If it fails go without */
@@ -134,7 +131,10 @@ static int sdl_event_thread(void * param)
134 131
135 /* 132 /*
136 * finally enter the button loop */ 133 * finally enter the button loop */
137 while(gui_message_loop()); 134 gui_message_loop();
135
136 if(picture_surface)
137 SDL_FreeSurface(picture_surface);
138 138
139 /* Order here is relevent to prevent deadlocks and use of destroyed 139 /* Order here is relevent to prevent deadlocks and use of destroyed
140 sync primitives by kernel threads */ 140 sync primitives by kernel threads */
@@ -151,7 +151,6 @@ void sim_do_exit(void)
151 151
152 SDL_Quit(); 152 SDL_Quit();
153 exit(EXIT_SUCCESS); 153 exit(EXIT_SUCCESS);
154 while(1);
155} 154}
156 155
157void system_init(void) 156void system_init(void)