diff options
author | Thomas Martitz <kugel@rockbox.org> | 2014-01-29 06:50:36 +0100 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2014-02-02 16:59:29 +0100 |
commit | 3a86352a5d71d30a807f48cf6f0910efe2655430 (patch) | |
tree | 195dd6ecb08075626d02b27622bdd65441271865 | |
parent | 7272a95b9c8e1e459b27a11a94514808693c693a (diff) | |
download | rockbox-3a86352a5d71d30a807f48cf6f0910efe2655430.tar.gz rockbox-3a86352a5d71d30a807f48cf6f0910efe2655430.zip |
sim/sdlapp: Do not quit immediately on panicf, but wait for quit.
Change-Id: I2f0b4b560f00a43ad4b240911e4c30a162deb6e3
-rw-r--r-- | firmware/target/hosted/sdl/button-sdl.c | 2 | ||||
-rw-r--r-- | firmware/target/hosted/sdl/system-sdl.c | 13 | ||||
-rw-r--r-- | firmware/target/hosted/sdl/system-sdl.h | 1 |
3 files changed, 15 insertions, 1 deletions
diff --git a/firmware/target/hosted/sdl/button-sdl.c b/firmware/target/hosted/sdl/button-sdl.c index eb4869ae25..91338bb0d5 100644 --- a/firmware/target/hosted/sdl/button-sdl.c +++ b/firmware/target/hosted/sdl/button-sdl.c | |||
@@ -278,7 +278,7 @@ static bool event_handler(SDL_Event *event) | |||
278 | } | 278 | } |
279 | case SDL_QUIT: | 279 | case SDL_QUIT: |
280 | /* Will post SDL_USEREVENT in shutdown_hw() if successful. */ | 280 | /* Will post SDL_USEREVENT in shutdown_hw() if successful. */ |
281 | sys_poweroff(); | 281 | sdl_sys_quit(); |
282 | break; | 282 | break; |
283 | case SDL_USEREVENT: | 283 | case SDL_USEREVENT: |
284 | return true; | 284 | return true; |
diff --git a/firmware/target/hosted/sdl/system-sdl.c b/firmware/target/hosted/sdl/system-sdl.c index 9904da4346..572d6d570a 100644 --- a/firmware/target/hosted/sdl/system-sdl.c +++ b/firmware/target/hosted/sdl/system-sdl.c | |||
@@ -196,6 +196,14 @@ static int sdl_event_thread(void * param) | |||
196 | return 0; | 196 | return 0; |
197 | } | 197 | } |
198 | 198 | ||
199 | static bool quitting; | ||
200 | |||
201 | void sdl_sys_quit(void) | ||
202 | { | ||
203 | quitting = true; | ||
204 | sys_poweroff(); | ||
205 | } | ||
206 | |||
199 | void power_off(void) | 207 | void power_off(void) |
200 | { | 208 | { |
201 | /* Shut down SDL event loop */ | 209 | /* Shut down SDL event loop */ |
@@ -270,6 +278,11 @@ void system_reboot(void) | |||
270 | 278 | ||
271 | void system_exception_wait(void) | 279 | void system_exception_wait(void) |
272 | { | 280 | { |
281 | if (evt_thread) | ||
282 | { | ||
283 | while (!quitting) | ||
284 | SDL_Delay(10); | ||
285 | } | ||
273 | system_reboot(); | 286 | system_reboot(); |
274 | } | 287 | } |
275 | 288 | ||
diff --git a/firmware/target/hosted/sdl/system-sdl.h b/firmware/target/hosted/sdl/system-sdl.h index 43ee0bdff1..3568910fae 100644 --- a/firmware/target/hosted/sdl/system-sdl.h +++ b/firmware/target/hosted/sdl/system-sdl.h | |||
@@ -56,6 +56,7 @@ void sys_poweroff(void); | |||
56 | void sys_handle_argv(int argc, char *argv[]); | 56 | void sys_handle_argv(int argc, char *argv[]); |
57 | void gui_message_loop(void); | 57 | void gui_message_loop(void); |
58 | void sim_do_exit(void) NORETURN_ATTR; | 58 | void sim_do_exit(void) NORETURN_ATTR; |
59 | void sdl_sys_quit(void); | ||
59 | 60 | ||
60 | extern bool background; /* True if the background image is enabled */ | 61 | extern bool background; /* True if the background image is enabled */ |
61 | extern bool showremote; | 62 | extern bool showremote; |