diff options
| author | Eli Zaretskii | 2013-09-01 18:43:43 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2013-09-01 18:43:43 +0300 |
| commit | bed10876dba330b24419a6144dc62db52bb273ab (patch) | |
| tree | a5480db866493e1fa7db43bdc2c8b4bbde0ac4a6 /src/thread.c | |
| parent | e57df8f77901a3964d21c3d57fb6769cf4511dc2 (diff) | |
| download | emacs-bed10876dba330b24419a6144dc62db52bb273ab.tar.gz emacs-bed10876dba330b24419a6144dc62db52bb273ab.zip | |
Fix crashes when unbind_for_thread_switch signals an error.
src/eval.c (unbind_for_thread_switch): Accept a 'struct
thread_state *' argument and use specpdl_ptr and specpdl of that
thread. Fixes crashes if find_symbol_value signals an error.
src/thread.c (post_acquire_global_lock): Update current_thread
before calling unbind_for_thread_switch. Pass the previous thread
to unbind_for_thread_switch.
Diffstat (limited to 'src/thread.c')
| -rw-r--r-- | src/thread.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/thread.c b/src/thread.c index 39a21518ec6..f060a002a3a 100644 --- a/src/thread.c +++ b/src/thread.c | |||
| @@ -55,15 +55,20 @@ static void | |||
| 55 | post_acquire_global_lock (struct thread_state *self) | 55 | post_acquire_global_lock (struct thread_state *self) |
| 56 | { | 56 | { |
| 57 | Lisp_Object buffer; | 57 | Lisp_Object buffer; |
| 58 | struct thread_state *prev_thread = current_thread; | ||
| 58 | 59 | ||
| 59 | if (self != current_thread) | 60 | /* Do this early on, so that code below could signal errors (e.g., |
| 61 | unbind_for_thread_switch might) correctly, because we are already | ||
| 62 | running in the context of the thread pointed by SELF. */ | ||
| 63 | current_thread = self; | ||
| 64 | |||
| 65 | if (prev_thread != current_thread) | ||
| 60 | { | 66 | { |
| 61 | /* CURRENT_THREAD is NULL if the previously current thread | 67 | /* PREV_THREAD is NULL if the previously current thread |
| 62 | exited. In this case, there is no reason to unbind, and | 68 | exited. In this case, there is no reason to unbind, and |
| 63 | trying will crash. */ | 69 | trying will crash. */ |
| 64 | if (current_thread != NULL) | 70 | if (prev_thread != NULL) |
| 65 | unbind_for_thread_switch (); | 71 | unbind_for_thread_switch (prev_thread); |
| 66 | current_thread = self; | ||
| 67 | rebind_for_thread_switch (); | 72 | rebind_for_thread_switch (); |
| 68 | } | 73 | } |
| 69 | 74 | ||