Commit fdd1b3e0 authored by Eli Zaretskii's avatar Eli Zaretskii Committed by Andreas Schwab

Avoid assertion violation when comparing with main-thread

* src/thread.c (unmark_main_thread): New function.
* src/lisp.h (unmark_main_thread): Prototype it.
* src/alloc.c (garbage_collect_1): Call it after sweeping.
(Bug#33073)

* test/src/thread-tests.el (threads-test-bug33073): New test.
parent 758e9a8e
Pipeline #1981 failed with stage
in 22 seconds
......@@ -6003,6 +6003,8 @@ garbage_collect_1 (void *end)
VECTOR_UNMARK (&buffer_defaults);
VECTOR_UNMARK (&buffer_local_symbols);
unmark_main_thread ();
check_cons_list ();
gc_in_progress = 0;
......
......@@ -3975,6 +3975,7 @@ extern void syms_of_module (void);
/* Defined in thread.c. */
extern void mark_threads (void);
extern void unmark_main_thread (void);
/* Defined in editfns.c. */
extern void insert1 (Lisp_Object);
......
......@@ -656,6 +656,12 @@ mark_threads (void)
flush_stack_call_func (mark_threads_callback, NULL);
}
void
unmark_main_thread (void)
{
main_thread.header.size &= ~ARRAY_MARK_FLAG;
}
static void
......
......@@ -347,4 +347,8 @@
(should (= (length (all-threads)) 1))
(should (equal (thread-last-error) '(error "Die, die, die!")))))
(ert-deftest threads-test-bug33073 ()
(let ((th (make-thread 'ignore)))
(should-not (equal th main-thread))))
;;; threads.el ends here
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment