emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r110349: * profiler.c (handle_profile


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110349: * profiler.c (handle_profiler_signal): Fix a malloc race
Date: Tue, 02 Oct 2012 12:38:10 -0700
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110349
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Tue 2012-10-02 12:38:10 -0700
message:
  * profiler.c (handle_profiler_signal): Fix a malloc race
  
  that caused Emacs to hang on Fedora 17 when profiling Lisp.
modified:
  src/ChangeLog
  src/profiler.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-10-02 18:51:51 +0000
+++ b/src/ChangeLog     2012-10-02 19:38:10 +0000
@@ -1,3 +1,8 @@
+2012-10-02  Paul Eggert  <address@hidden>
+
+       * profiler.c (handle_profiler_signal): Fix a malloc race
+       that caused Emacs to hang on Fedora 17 when profiling Lisp.
+
 2012-10-02  Jan Djärv  <address@hidden>
 
        * nsterm.m (windowDidEnterFullScreen): Remove fprintf.

=== modified file 'src/profiler.c'
--- a/src/profiler.c    2012-10-02 06:30:40 +0000
+++ b/src/profiler.c    2012-10-02 19:38:10 +0000
@@ -238,6 +238,7 @@
     cpu_gc_count = saturated_add (cpu_gc_count, 1);
   else
     {
+      Lisp_Object oquit;
       EMACS_INT count = 1;
 #ifdef HAVE_TIMER_SETTIME
       if (profiler_timer_ok)
@@ -247,8 +248,16 @@
          count += overruns;
        }
 #endif
+      /* record_backtrace uses hash functions that call Fequal, which
+        uses QUIT, which can call malloc, which can cause disaster in
+        a signal handler.  So inhibit QUIT.  */
+      oquit = Vinhibit_quit;
+      Vinhibit_quit = Qt;
+
       eassert (HASH_TABLE_P (cpu_log));
       record_backtrace (XHASH_TABLE (cpu_log), count);
+
+      Vinhibit_quit = oquit;
     }
 }
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]