]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid crashes when profiling multi-threaded Lisp (bug#76970)
authorPip Cet <pipcet@protonmail.com>
Sat, 12 Jul 2025 10:22:01 +0000 (10:22 +0000)
committerEshel Yaron <me@eshelyaron.com>
Thu, 24 Jul 2025 08:13:20 +0000 (10:13 +0200)
* src/eval.c (backtrace_p): Check 'current_thread' before
dereferencing it.

(cherry picked from commit fce86c7e9523b9b6c29241ae9d1dea340f0d849c)

src/eval.c

index 2e96c5845246ea5acdefef9ecd752cb1af2b68c8..b606990a297c5a53279bff8832b9e3d67d002c10 100644 (file)
@@ -159,7 +159,11 @@ set_backtrace_debug_on_exit (union specbinding *pdl, bool doe)
 
 bool
 backtrace_p (union specbinding *pdl)
-{ return specpdl ? pdl >= specpdl : false; }
+{
+  if (current_thread && specpdl && pdl)
+    return pdl >= specpdl;
+  return false;
+}
 
 static bool
 backtrace_thread_p (struct thread_state *tstate, union specbinding *pdl)