summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/misc.c1
-rw-r--r--firmware/target/hosted/sdl/button-sdl.c1
-rw-r--r--firmware/target/hosted/sdl/thread-sdl.c7
3 files changed, 6 insertions, 3 deletions
diff --git a/apps/misc.c b/apps/misc.c
index 3dfc2892ca..95c0dd6e34 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -256,7 +256,6 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter)
(void)parameter;
bookmark_autobookmark(false);
call_storage_idle_notifys(true);
- exit(0);
#else
long msg_id = -1;
int i;
diff --git a/firmware/target/hosted/sdl/button-sdl.c b/firmware/target/hosted/sdl/button-sdl.c
index 629d3aa9bd..e9fc03792c 100644
--- a/firmware/target/hosted/sdl/button-sdl.c
+++ b/firmware/target/hosted/sdl/button-sdl.c
@@ -176,7 +176,6 @@ void gui_message_loop(void)
case SDL_QUIT:
{
sim_exit_irq_handler();
- SDL_Quit();
exit(EXIT_SUCCESS);
break;
}
diff --git a/firmware/target/hosted/sdl/thread-sdl.c b/firmware/target/hosted/sdl/thread-sdl.c
index 28a9cb8d3a..da43d6ea9f 100644
--- a/firmware/target/hosted/sdl/thread-sdl.c
+++ b/firmware/target/hosted/sdl/thread-sdl.c
@@ -566,7 +566,12 @@ void remove_thread(unsigned int thread_id)
void thread_exit(void)
{
- remove_thread(THREAD_ID_CURRENT);
+ struct thread_entry *t = thread_id_entry(THREAD_ID_CURRENT);
+ /* the main thread cannot be removed since it's created implicitely
+ * by starting the program;
+ * it has no valid jumpbuf to exit, do nothing for now */
+ if (t != &threads[0])
+ remove_thread(t->id);
}
void thread_wait(unsigned int thread_id)