diff options
| author | Paul Eggert | 2012-10-02 12:38:10 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-10-02 12:38:10 -0700 |
| commit | a3c5c0c5800ca55a2b0548d3d30a39f570b10e90 (patch) | |
| tree | ce2ff1ec87183735f4fb43aa3549f322e7d2ef5a /src | |
| parent | 914e743b60af339ae577385a18685f8a40f9fe8f (diff) | |
| download | emacs-a3c5c0c5800ca55a2b0548d3d30a39f570b10e90.tar.gz emacs-a3c5c0c5800ca55a2b0548d3d30a39f570b10e90.zip | |
* profiler.c (handle_profiler_signal): Fix a malloc race
that caused Emacs to hang on Fedora 17 when profiling Lisp.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/profiler.c | 9 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index e905a800f70..ced0e057e27 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-10-02 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | * profiler.c (handle_profiler_signal): Fix a malloc race | ||
| 4 | that caused Emacs to hang on Fedora 17 when profiling Lisp. | ||
| 5 | |||
| 1 | 2012-10-02 Jan Djärv <jan.h.d@swipnet.se> | 6 | 2012-10-02 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 7 | ||
| 3 | * nsterm.m (windowDidEnterFullScreen): Remove fprintf. | 8 | * nsterm.m (windowDidEnterFullScreen): Remove fprintf. |
diff --git a/src/profiler.c b/src/profiler.c index 3282b8b335b..7b4ffc7f7bf 100644 --- a/src/profiler.c +++ b/src/profiler.c | |||
| @@ -238,6 +238,7 @@ handle_profiler_signal (int signal) | |||
| 238 | cpu_gc_count = saturated_add (cpu_gc_count, 1); | 238 | cpu_gc_count = saturated_add (cpu_gc_count, 1); |
| 239 | else | 239 | else |
| 240 | { | 240 | { |
| 241 | Lisp_Object oquit; | ||
| 241 | EMACS_INT count = 1; | 242 | EMACS_INT count = 1; |
| 242 | #ifdef HAVE_TIMER_SETTIME | 243 | #ifdef HAVE_TIMER_SETTIME |
| 243 | if (profiler_timer_ok) | 244 | if (profiler_timer_ok) |
| @@ -247,8 +248,16 @@ handle_profiler_signal (int signal) | |||
| 247 | count += overruns; | 248 | count += overruns; |
| 248 | } | 249 | } |
| 249 | #endif | 250 | #endif |
| 251 | /* record_backtrace uses hash functions that call Fequal, which | ||
| 252 | uses QUIT, which can call malloc, which can cause disaster in | ||
| 253 | a signal handler. So inhibit QUIT. */ | ||
| 254 | oquit = Vinhibit_quit; | ||
| 255 | Vinhibit_quit = Qt; | ||
| 256 | |||
| 250 | eassert (HASH_TABLE_P (cpu_log)); | 257 | eassert (HASH_TABLE_P (cpu_log)); |
| 251 | record_backtrace (XHASH_TABLE (cpu_log), count); | 258 | record_backtrace (XHASH_TABLE (cpu_log), count); |
| 259 | |||
| 260 | Vinhibit_quit = oquit; | ||
| 252 | } | 261 | } |
| 253 | } | 262 | } |
| 254 | 263 | ||