summaryrefslogtreecommitdiffstats
path: root/firmware/target/hosted/sdl
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2014-01-29 06:50:36 +0100
committerThomas Martitz <kugel@rockbox.org>2014-02-02 16:59:29 +0100
commit3a86352a5d71d30a807f48cf6f0910efe2655430 (patch)
tree195dd6ecb08075626d02b27622bdd65441271865 /firmware/target/hosted/sdl
parent7272a95b9c8e1e459b27a11a94514808693c693a (diff)
downloadrockbox-3a86352a5d71d30a807f48cf6f0910efe2655430.tar.gz
rockbox-3a86352a5d71d30a807f48cf6f0910efe2655430.tar.bz2
rockbox-3a86352a5d71d30a807f48cf6f0910efe2655430.zip
sim/sdlapp: Do not quit immediately on panicf, but wait for quit.
Change-Id: I2f0b4b560f00a43ad4b240911e4c30a162deb6e3
Diffstat (limited to 'firmware/target/hosted/sdl')
-rw-r--r--firmware/target/hosted/sdl/button-sdl.c2
-rw-r--r--firmware/target/hosted/sdl/system-sdl.c13
-rw-r--r--firmware/target/hosted/sdl/system-sdl.h1
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)
}
case SDL_QUIT:
/* Will post SDL_USEREVENT in shutdown_hw() if successful. */
- sys_poweroff();
+ sdl_sys_quit();
break;
case SDL_USEREVENT:
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)
return 0;
}
+static bool quitting;
+
+void sdl_sys_quit(void)
+{
+ quitting = true;
+ sys_poweroff();
+}
+
void power_off(void)
{
/* Shut down SDL event loop */
@@ -270,6 +278,11 @@ void system_reboot(void)
void system_exception_wait(void)
{
+ if (evt_thread)
+ {
+ while (!quitting)
+ SDL_Delay(10);
+ }
system_reboot();
}
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);
void sys_handle_argv(int argc, char *argv[]);
void gui_message_loop(void);
void sim_do_exit(void) NORETURN_ATTR;
+void sdl_sys_quit(void);
extern bool background; /* True if the background image is enabled */
extern bool showremote;