From: Eli Zaretskii Date: Tue, 8 Oct 2019 13:57:23 +0000 (+0300) Subject: Fix crashes on TTY frames due to "C-x 6 f" X-Git-Tag: emacs-27.0.90~1219 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6469f9cd9290c2ed3317b1fd4fbb4288295b327f;p=emacs.git 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 . --- diff --git a/src/dispnew.c b/src/dispnew.c index 4cf131522ec..4dd5ee2a1e0 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 29d49d57dfd..1586a02e3d4 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;