Merge from origin/emacs-30

4211d85eec Fix rare segfaults due to freed fontsets
44c26140b6 ; Fix infloop in checkdoc-next-docstring
25f5372166 Avoid putting a dead buffer in the minibuffer window (Bug...
This commit is contained in:
Eli Zaretskii 2024-08-24 06:04:51 -04:00
commit 1e528f38b5
4 changed files with 33 additions and 16 deletions

View file

@ -989,7 +989,7 @@ buffer and save warnings in a separate buffer."
Return nil if there are no more doc strings."
(let (found)
(while (and (not (setq found (checkdoc--next-docstring)))
(beginning-of-defun -1)))
(beginning-of-defun-raw -1)))
found))
(defun checkdoc--next-docstring ()

View file

@ -63,7 +63,7 @@ Lisp_Object last_minibuf_string;
static Lisp_Object minibuf_prompt;
/* The frame containinug the most recently opened Minibuffer. This is
/* The frame containing the most recently opened minibuffer. This is
used only when `minibuffer-follows-selected-frame' is neither nil
nor t. */
@ -1248,27 +1248,36 @@ static void
minibuffer_unwind (void)
{
struct frame *f;
struct window *w;
Lisp_Object window;
Lisp_Object entry;
if (NILP (exp_MB_frame)) return; /* "Can't happen." */
f = XFRAME (exp_MB_frame);
window = f->minibuffer_window;
w = XWINDOW (window);
if (FRAME_LIVE_P (f))
{
/* minibuf_window = sf->minibuffer_window; */
if (!NILP (w->prev_buffers))
Lisp_Object window = f->minibuffer_window;
if (WINDOW_LIVE_P (window))
{
entry = Fcar (w->prev_buffers);
w->prev_buffers = Fcdr (w->prev_buffers);
set_window_buffer (window, Fcar (entry), 0, 0);
Fset_window_start (window, Fcar (Fcdr (entry)), Qnil);
Fset_window_point (window, Fcar (Fcdr (Fcdr (entry))));
struct window *w = XWINDOW (window);
/* minibuf_window = sf->minibuffer_window; */
if (!NILP (w->prev_buffers))
{
Lisp_Object entry = Fcar (w->prev_buffers);
if (BUFFERP (Fcar (entry))
&& BUFFER_LIVE_P (XBUFFER (Fcar (entry))))
{
wset_prev_buffers (w, Fcdr (w->prev_buffers));
set_window_buffer (window, Fcar (entry), 0, 0);
Fset_window_start (window, Fcar (Fcdr (entry)), Qnil);
Fset_window_point (window, Fcar (Fcdr (Fcdr (entry))));
}
else
set_window_buffer (window, nth_minibuffer (0), 0, 0);
}
else
set_window_buffer (window, nth_minibuffer (0), 0, 0);
}
else
set_window_buffer (window, nth_minibuffer (0), 0, 0);
}
}

View file

@ -4230,6 +4230,9 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer,
specpdl_ref count = SPECPDL_INDEX ();
bool samebuf = EQ (buffer, w->contents);
/* It's never OK to assign WINDOW a dead buffer. */
eassert (BUFFER_LIVE_P (b));
wset_buffer (w, buffer);
if (EQ (window, selected_window))

View file

@ -736,6 +736,11 @@ recompute_basic_faces (struct frame *f)
clear_face_cache (false);
if (!realize_basic_faces (f))
emacs_abort ();
/* Force complete face recalculation next time we use the display
code, because realize_basic_faces could free the fontset used
by non-ASCII faces corresponding to ASCII faces of the basic
faces, and attempt to use that fontset might segfault. */
f->face_change = true;
}
}