From bc2f8bbc079b2b143c06739163ba229aedef90c9 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Wed, 26 May 2010 17:16:19 +0000 Subject: Since the sdl to target tree move, the main thread cannot be removed anymore, since it's now the default thread which is implicitely created by starting the sim. This caused a segfault that r26283 tried to fix. Revert r26283 and protect the main thread from being removed. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26315 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/hosted/sdl/button-sdl.c | 1 - firmware/target/hosted/sdl/thread-sdl.c | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'firmware') 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) -- cgit v1.2.3