]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid segfault when profiling Lisp programs with threads
authorEli Zaretskii <eliz@gnu.org>
Sat, 21 Jun 2025 08:53:24 +0000 (11:53 +0300)
committerEshel Yaron <me@eshelyaron.com>
Sun, 22 Jun 2025 08:09:40 +0000 (10:09 +0200)
* src/eval.c (backtrace_top): Don't segfault if current_thread is
NULL.  (Bug#76970)

(cherry picked from commit dd95447b05eb2e86e0500d953f43213df028c19a)

src/eval.c

index 0ad26c4386712e833a6e7b79705305b9c0ac98ca..2e96c5845246ea5acdefef9ecd752cb1af2b68c8 100644 (file)
@@ -171,7 +171,7 @@ backtrace_top (void)
   /* This is so "xbacktrace" doesn't crash in pdumped Emacs if they
      invoke the command before init_eval_once_for_pdumper initializes
      specpdl machinery.  See also backtrace_p above.  */
-  if (!specpdl)
+  if (!current_thread || !specpdl)
     return NULL;
 
   union specbinding *pdl = specpdl_ptr - 1;