From: Pip Cet Date: Sat, 14 Mar 2020 18:26:33 +0000 (+0000) Subject: Make sure we mark reachable killed buffers during GC X-Git-Tag: emacs-28.0.90~7754 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=afaf2f465188ab1f438ff3e021260e7c529b1b9d;p=emacs.git Make sure we mark reachable killed buffers during GC * src/alloc.c (live_buffer_holding): Add ALL_BUFFERS argument for returning killed buffers. (mark_maybe_object, mark_maybe_pointer): Use the additional argument. (Bug#39962) --- diff --git a/src/alloc.c b/src/alloc.c index a35b48cfb22..3d1090c383d 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -4597,20 +4597,22 @@ live_vector_p (struct mem_node *m, void *p) } /* If P is a pointer into a live buffer, return the buffer. - Otherwise, return nil. M is a pointer to the mem_block for P. */ + Otherwise, return nil. M is a pointer to the mem_block for P. + Also return killed buffers if ALL-BUFFERS is true. */ static Lisp_Object -live_buffer_holding (struct mem_node *m, void *p) +live_buffer_holding (struct mem_node *m, void *p, bool all_buffers) { - /* P must point into the block, and the buffer - must not have been killed. */ + /* P must point into the block, and the buffer must not + have been killed unless ALL-BUFFERS is true. */ if (m->type == MEM_TYPE_BUFFER) { struct buffer *b = m->start; char *cb = m->start; char *cp = p; ptrdiff_t offset = cp - cb; - if (0 <= offset && offset < sizeof *b && !NILP (b->name_)) + if (0 <= offset && offset < sizeof *b + && (all_buffers || !NILP (b->name_))) { Lisp_Object obj; XSETBUFFER (obj, b); @@ -4623,7 +4625,7 @@ live_buffer_holding (struct mem_node *m, void *p) static bool live_buffer_p (struct mem_node *m, void *p) { - return !NILP (live_buffer_holding (m, p)); + return !NILP (live_buffer_holding (m, p, false)); } /* Mark OBJ if we can prove it's a Lisp_Object. */ @@ -4681,7 +4683,7 @@ mark_maybe_object (Lisp_Object obj) case Lisp_Vectorlike: mark_p = (EQ (obj, live_vector_holding (m, po)) - || EQ (obj, live_buffer_holding (m, po))); + || EQ (obj, live_buffer_holding (m, po, true))); break; default: @@ -4751,7 +4753,7 @@ mark_maybe_pointer (void *p) break; case MEM_TYPE_BUFFER: - obj = live_buffer_holding (m, p); + obj = live_buffer_holding (m, p, true); break; case MEM_TYPE_CONS: