emacs-diffs
[Top][All Lists]
Advanced

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

master 1e528f38b50 7/7: Merge from origin/emacs-30


From: Eli Zaretskii
Subject: master 1e528f38b50 7/7: Merge from origin/emacs-30
Date: Sat, 24 Aug 2024 06:07:20 -0400 (EDT)

branch: master
commit 1e528f38b50b402614fb33a8e83ffb0998148bc7
Merge: 1d8ff948d7c 4211d85eec0
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Merge from origin/emacs-30
    
    4211d85eec0 Fix rare segfaults due to freed fontsets
    44c26140b6e ; Fix infloop in checkdoc-next-docstring
    25f53721668 Avoid putting a dead buffer in the minibuffer window (Bug...
---
 lisp/emacs-lisp/checkdoc.el |  2 +-
 src/minibuf.c               | 39 ++++++++++++++++++++++++---------------
 src/window.c                |  3 +++
 src/xfaces.c                |  5 +++++
 4 files changed, 33 insertions(+), 16 deletions(-)

diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el
index d81eba7e85c..6865a02f9e8 100644
--- a/lisp/emacs-lisp/checkdoc.el
+++ b/lisp/emacs-lisp/checkdoc.el
@@ -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 ()
diff --git a/src/minibuf.c b/src/minibuf.c
index 1dfee0a59c9..f16880011f7 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -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);
     }
 }
 
diff --git a/src/window.c b/src/window.c
index 559919689a3..35092ddd582 100644
--- a/src/window.c
+++ b/src/window.c
@@ -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))
diff --git a/src/xfaces.c b/src/xfaces.c
index 684b6ccfac7..34897817ffd 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -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;
     }
 }
 



reply via email to

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