emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-26 fdd1b3e 2/2: Avoid assertion violation when compa


From: Andreas Schwab
Subject: [Emacs-diffs] emacs-26 fdd1b3e 2/2: Avoid assertion violation when comparing with main-thread
Date: Mon, 10 Jun 2019 06:54:17 -0400 (EDT)

branch: emacs-26
commit fdd1b3e02097966e7ffe8065f6e3d27f5f540d0a
Author: Eli Zaretskii <address@hidden>
Commit: Andreas Schwab <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 6aeac14..1a72941 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -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;
diff --git a/src/lisp.h b/src/lisp.h
index 782c396..2455169 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -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);
diff --git a/src/thread.c b/src/thread.c
index 0cd1ae3..47f55e7 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 e8d66b8..b57b4f9 100644
--- a/test/src/thread-tests.el
+++ b/test/src/thread-tests.el
@@ -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



reply via email to

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