emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 6469f9c: Fix crashes on TTY frames due to "C-x 6 f"


From: Eli Zaretskii
Subject: [Emacs-diffs] master 6469f9c: Fix crashes on TTY frames due to "C-x 6 f"
Date: Tue, 8 Oct 2019 09:58:40 -0400 (EDT)

branch: master
commit 6469f9cd9290c2ed3317b1fd4fbb4288295b327f
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Fix crashes on TTY frames due to "C-x 6 f"
    
    * src/xdisp.c (redisplay_internal): Revert the recent change
    regarding TTY frames' garbaged flag.  It is not needed.
    
    * src/dispnew.c (adjust_frame_glyphs_for_frame_redisplay):
    When returning due to mismatch between the desired and actual
    dimensions of the glyph matrix, set the frame's garbaged flag
    for TTY frames.  This avoids crashes when we are later called
    from redisplay.  Reported by Ergus <address@hidden>.
---
 src/dispnew.c | 14 +++++++++++++-
 src/xdisp.c   |  2 +-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/dispnew.c b/src/dispnew.c
index 4cf1315..4dd5ee2 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -2051,7 +2051,19 @@ adjust_frame_glyphs_for_frame_redisplay (struct frame *f)
         to the frame width (from CHANGE_FRAME_SIZE_1).  */
       if (matrix_dim.width != FRAME_TOTAL_COLS (f)
          || matrix_dim.height != FRAME_TOTAL_LINES (f))
-       return;
+       {
+         /* We have reallocated the frame's glyph pools, but didn't
+            update the glyph pointers in the frame's glyph matrices
+            to use the reallocated pools (that happens below, in the
+            call to adjust_glyph_matrix).  Set the frame's garbaged
+            flag, so that when we are called again from
+            redisplay_internal, we don't erroneously call
+            save_current_matrix, because it will use the wrong glyph
+            pointers, and will most probably crash.  */
+         if (!FRAME_WINDOW_P (f) && pool_changed_p)
+           SET_FRAME_GARBAGED (f);
+         return;
+       }
 
       eassert (matrix_dim.width == FRAME_TOTAL_COLS (f)
               && matrix_dim.height == FRAME_TOTAL_LINES (f));
diff --git a/src/xdisp.c b/src/xdisp.c
index 29d49d5..1586a02 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -15684,7 +15684,7 @@ redisplay_internal (void)
                     the frame.  Don't do that on TTY frames, since we
                     need to keep the garbaged flag in that case when
                     the frame has been resized.  */
-                  if (FRAME_WINDOW_P (f) && FRAME_GARBAGED_P (f))
+                  if (FRAME_GARBAGED_P (f))
                    {
                      fset_redisplay (f);
                      f->garbaged = false;



reply via email to

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