]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix crashes on TTY frames due to "C-x 6 f"
authorEli Zaretskii <eliz@gnu.org>
Tue, 8 Oct 2019 13:57:23 +0000 (16:57 +0300)
committerEli Zaretskii <eliz@gnu.org>
Tue, 8 Oct 2019 13:57:23 +0000 (16:57 +0300)
* 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 <spacibba@aol.com>.

src/dispnew.c
src/xdisp.c

index 4cf131522ecdfeee90b118bfaa6aec78c518d546..4dd5ee2a1e029eb5b827873ce3ddd10d620a7ae6 100644 (file)
@@ -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));
index 29d49d57dfd10fe20e4ba07b2077d543068888d4..1586a02e3d43c4737e16aaedc246143531b1d309 100644 (file)
@@ -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;