emacs-diffs
[Top][All Lists]
Advanced

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

emacs-28 ef5651cc77: Fix segfaults when starting on 80x26 TTY frames


From: Eli Zaretskii
Subject: emacs-28 ef5651cc77: Fix segfaults when starting on 80x26 TTY frames
Date: Thu, 2 Jun 2022 06:42:58 -0400 (EDT)

branch: emacs-28
commit ef5651cc77b9a57bd6af5f9914c26528355c80be
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix segfaults when starting on 80x26 TTY frames
    
    * src/dispnew.c (adjust_frame_glyphs_for_frame_redisplay): Make
    sure we have valid frame glyph matrices for the interactive
    session.  (Bug#55760)
    (adjust_frame_glyphs): Add assertions for when we fail to allocate
    valid frame glyph matrices for a TTY frame.
---
 src/dispnew.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/src/dispnew.c b/src/dispnew.c
index 332ba54ee7..39e5469db0 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -1837,7 +1837,18 @@ adjust_frame_glyphs (struct frame *f)
   if (FRAME_WINDOW_P (f))
     adjust_frame_glyphs_for_window_redisplay (f);
   else
-    adjust_frame_glyphs_for_frame_redisplay (f);
+    {
+      adjust_frame_glyphs_for_frame_redisplay (f);
+      eassert (FRAME_INITIAL_P (f)
+              || noninteractive
+              || !initialized
+              || (f->current_matrix
+                  && f->current_matrix->nrows > 0
+                  && f->current_matrix->rows
+                  && f->desired_matrix
+                  && f->desired_matrix->nrows > 0
+                  && f->desired_matrix->rows));
+    }
 
   /* Don't forget the buffer for decode_mode_spec.  */
   adjust_decode_mode_spec_buffer (f);
@@ -2119,6 +2130,19 @@ adjust_frame_glyphs_for_frame_redisplay (struct frame *f)
          SET_FRAME_GARBAGED (f);
        }
     }
+  else if (!FRAME_INITIAL_P (f) && !noninteractive && initialized)
+    {
+      if (!f->desired_matrix->nrows || !f->desired_matrix->rows)
+       {
+         adjust_glyph_matrix (NULL, f->desired_matrix, 0, 0, matrix_dim);
+         SET_FRAME_GARBAGED (f);
+       }
+      if (!f->current_matrix->nrows || !f->current_matrix->rows)
+       {
+         adjust_glyph_matrix (NULL, f->current_matrix, 0, 0, matrix_dim);
+         SET_FRAME_GARBAGED (f);
+       }
+    }
 }
 
 



reply via email to

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