emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 7356743: Avoid assertion violation when comparing w


From: Eli Zaretskii
Subject: [Emacs-diffs] master 7356743: Avoid assertion violation when comparing with main-thread
Date: Wed, 17 Oct 2018 11:20:54 -0400 (EDT)

branch: master
commit 73567432329a245b2eb02e4c61adea2c8eab6b3a
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    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.
---
 src/alloc.c              | 2 ++
 src/lisp.h               | 1 +
 src/thread.c             | 6 ++++++
 test/src/thread-tests.el | 4 ++++
 4 files changed, 13 insertions(+)

diff --git a/src/alloc.c b/src/alloc.c
index 3b15079..0e48b33 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -5863,6 +5863,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;
diff --git a/src/lisp.h b/src/lisp.h
index a7a26ef..145901d 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -4011,6 +4011,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);
diff --git a/src/thread.c b/src/thread.c
index fc93344..3674af0 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -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
diff --git a/test/src/thread-tests.el b/test/src/thread-tests.el
index 109e711..36bb637 100644
--- a/test/src/thread-tests.el
+++ b/test/src/thread-tests.el
@@ -388,4 +388,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



reply via email to

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