aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2024-06-05 19:18:49 +0300
committerEli Zaretskii2024-06-05 19:18:49 +0300
commite84057d072eaaa5e395d796a41bb78613844fb7c (patch)
tree78dca06062239911885eb5cacd5dd979392d3be1 /src
parentcf9ff842395b8a4787b717d274c3151c1ab0a970 (diff)
downloademacs-e84057d072eaaa5e395d796a41bb78613844fb7c.tar.gz
emacs-e84057d072eaaa5e395d796a41bb78613844fb7c.zip
Another attempt to prevent crashes when resizing TTY frames
* src/dispnew.c (frame_size_change_delayed): Accept frame as argument, and check the 'new_size_p' flag of the frame in addition to 'delayed_size_change'. Callers changed. (window_to_frame_vpos, build_frame_matrix_from_leaf_window): Call 'frame_size_change_delayed' instead of looking at delayed_size_change alone. (Bug#71289)
Diffstat (limited to 'src')
-rw-r--r--src/cm.c2
-rw-r--r--src/dispextern.h2
-rw-r--r--src/dispnew.c14
3 files changed, 9 insertions, 9 deletions
diff --git a/src/cm.c b/src/cm.c
index c6c64d95a2a..f6101272d69 100644
--- a/src/cm.c
+++ b/src/cm.c
@@ -113,7 +113,7 @@ cmcheckmagic (struct tty_display_info *tty)
113{ 113{
114 /* If we have an unhandled SIGWINCH, we don't really know what our 114 /* If we have an unhandled SIGWINCH, we don't really know what our
115 up-to-date frame dimensions are. */ 115 up-to-date frame dimensions are. */
116 if (frame_size_change_delayed ()) 116 if (frame_size_change_delayed (XFRAME (tty->top_frame)))
117 return; 117 return;
118 if (curX (tty) == FrameCols (tty)) 118 if (curX (tty) == FrameCols (tty))
119 { 119 {
diff --git a/src/dispextern.h b/src/dispextern.h
index 8207e74a90c..35e1893c83c 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -3812,7 +3812,7 @@ extern void gui_update_window_end (struct window *, bool, bool);
3812#endif 3812#endif
3813void do_pending_window_change (bool); 3813void do_pending_window_change (bool);
3814void change_frame_size (struct frame *, int, int, bool, bool, bool); 3814void change_frame_size (struct frame *, int, int, bool, bool, bool);
3815extern bool frame_size_change_delayed (void); 3815extern bool frame_size_change_delayed (struct frame *);
3816void init_display (void); 3816void init_display (void);
3817void syms_of_display (void); 3817void syms_of_display (void);
3818extern void spec_glyph_lookup_face (struct window *, GLYPH *); 3818extern void spec_glyph_lookup_face (struct window *, GLYPH *);
diff --git a/src/dispnew.c b/src/dispnew.c
index dfa36a9f54f..a3c5cbbcf00 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -2643,7 +2643,7 @@ build_frame_matrix_from_leaf_window (struct glyph_matrix *frame_matrix, struct w
2643#ifdef GLYPH_DEBUG 2643#ifdef GLYPH_DEBUG
2644 /* Window row window_y must be a slice of frame row 2644 /* Window row window_y must be a slice of frame row
2645 frame_y. */ 2645 frame_y. */
2646 eassert (delayed_size_change 2646 eassert (frame_size_change_delayed (XFRAME (w->frame))
2647 || glyph_row_slice_p (window_row, frame_row)); 2647 || glyph_row_slice_p (window_row, frame_row));
2648 2648
2649 /* If rows are in sync, we don't have to copy glyphs because 2649 /* If rows are in sync, we don't have to copy glyphs because
@@ -3150,7 +3150,7 @@ window_to_frame_vpos (struct window *w, int vpos)
3150 eassert (!FRAME_WINDOW_P (XFRAME (w->frame))); 3150 eassert (!FRAME_WINDOW_P (XFRAME (w->frame)));
3151 eassert (vpos >= 0 && vpos <= w->desired_matrix->nrows); 3151 eassert (vpos >= 0 && vpos <= w->desired_matrix->nrows);
3152 vpos += WINDOW_TOP_EDGE_LINE (w); 3152 vpos += WINDOW_TOP_EDGE_LINE (w);
3153 eassert (delayed_size_change 3153 eassert (frame_size_change_delayed (XFRAME (w->frame))
3154 || (vpos >= 0 && vpos <= FRAME_TOTAL_LINES (XFRAME (w->frame)))); 3154 || (vpos >= 0 && vpos <= FRAME_TOTAL_LINES (XFRAME (w->frame))));
3155 return vpos; 3155 return vpos;
3156} 3156}
@@ -6081,13 +6081,13 @@ change_frame_size (struct frame *f, int new_width, int new_height,
6081 change_frame_size_1 (f, new_width, new_height, pretend, delay, safe); 6081 change_frame_size_1 (f, new_width, new_height, pretend, delay, safe);
6082} 6082}
6083 6083
6084/* Return non-zero if we delayed size-changes and haven't handled them 6084/* Return non-zero if we delayed size-changes of frame F and haven't
6085 yet, which means we cannot be sure about the exact dimensions of our 6085 handled them yet, which means we cannot be sure about the exact
6086 frames. */ 6086 dimensions of our frames. */
6087bool 6087bool
6088frame_size_change_delayed (void) 6088frame_size_change_delayed (struct frame *f)
6089{ 6089{
6090 return delayed_size_change; 6090 return (delayed_size_change || f->new_size_p);
6091} 6091}
6092 6092
6093/*********************************************************************** 6093/***********************************************************************