diff options
| author | Eli Zaretskii | 2024-06-03 20:37:31 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2024-06-03 20:37:31 +0300 |
| commit | eb9afd558ec506f1d349dbb61668d6231fda136f (patch) | |
| tree | 070cd9bd3722bd6db296c188276eb51f0ee20b63 /src | |
| parent | 4395f4d4530db77156b20209c1a81dce22c6e62d (diff) | |
| download | emacs-eb9afd558ec506f1d349dbb61668d6231fda136f.tar.gz emacs-eb9afd558ec506f1d349dbb61668d6231fda136f.zip | |
Avoid crashes and assertions while handling SIGWINCH
* src/dispnew.c (build_frame_matrix_from_leaf_window)
(window_to_frame_vpos): Avoid assertion violations when we have an
unhandled SIGWINCH.
(frame_size_change_delayed): New function.
* src/dispextern.h (frame_size_change_delayed): Add prototype.
* src/cm.c (cmcheckmagic): Don't check magicwrap if we have an
unhandled SIGWINCH. (Bug#71289)
Diffstat (limited to 'src')
| -rw-r--r-- | src/cm.c | 4 | ||||
| -rw-r--r-- | src/dispextern.h | 1 | ||||
| -rw-r--r-- | src/dispnew.c | 15 |
3 files changed, 18 insertions, 2 deletions
| @@ -111,6 +111,10 @@ addcol (tty, n) { | |||
| 111 | void | 111 | void |
| 112 | cmcheckmagic (struct tty_display_info *tty) | 112 | cmcheckmagic (struct tty_display_info *tty) |
| 113 | { | 113 | { |
| 114 | /* If we have unhandled SIGWINCH, we don't really know what are our | ||
| 115 | up-to-date frame diumensions. */ | ||
| 116 | if (frame_size_change_delayed ()) | ||
| 117 | return; | ||
| 114 | if (curX (tty) == FrameCols (tty)) | 118 | if (curX (tty) == FrameCols (tty)) |
| 115 | { | 119 | { |
| 116 | if (!MagicWrap (tty) || curY (tty) >= FrameRows (tty) - 1) | 120 | if (!MagicWrap (tty) || curY (tty) >= FrameRows (tty) - 1) |
diff --git a/src/dispextern.h b/src/dispextern.h index 28e59700469..8207e74a90c 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -3812,6 +3812,7 @@ extern void gui_update_window_end (struct window *, bool, bool); | |||
| 3812 | #endif | 3812 | #endif |
| 3813 | void do_pending_window_change (bool); | 3813 | void do_pending_window_change (bool); |
| 3814 | void change_frame_size (struct frame *, int, int, bool, bool, bool); | 3814 | void change_frame_size (struct frame *, int, int, bool, bool, bool); |
| 3815 | extern bool frame_size_change_delayed (void); | ||
| 3815 | void init_display (void); | 3816 | void init_display (void); |
| 3816 | void syms_of_display (void); | 3817 | void syms_of_display (void); |
| 3817 | extern void spec_glyph_lookup_face (struct window *, GLYPH *); | 3818 | extern void spec_glyph_lookup_face (struct window *, GLYPH *); |
diff --git a/src/dispnew.c b/src/dispnew.c index 8eda8dbb358..dfa36a9f54f 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -2643,7 +2643,8 @@ 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 (glyph_row_slice_p (window_row, frame_row)); | 2646 | eassert (delayed_size_change |
| 2647 | || glyph_row_slice_p (window_row, frame_row)); | ||
| 2647 | 2648 | ||
| 2648 | /* 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 |
| 2649 | frame and window share glyphs. */ | 2650 | frame and window share glyphs. */ |
| @@ -3149,7 +3150,8 @@ window_to_frame_vpos (struct window *w, int vpos) | |||
| 3149 | eassert (!FRAME_WINDOW_P (XFRAME (w->frame))); | 3150 | eassert (!FRAME_WINDOW_P (XFRAME (w->frame))); |
| 3150 | eassert (vpos >= 0 && vpos <= w->desired_matrix->nrows); | 3151 | eassert (vpos >= 0 && vpos <= w->desired_matrix->nrows); |
| 3151 | vpos += WINDOW_TOP_EDGE_LINE (w); | 3152 | vpos += WINDOW_TOP_EDGE_LINE (w); |
| 3152 | eassert (vpos >= 0 && vpos <= FRAME_TOTAL_LINES (XFRAME (w->frame))); | 3153 | eassert (delayed_size_change |
| 3154 | || (vpos >= 0 && vpos <= FRAME_TOTAL_LINES (XFRAME (w->frame)))); | ||
| 3153 | return vpos; | 3155 | return vpos; |
| 3154 | } | 3156 | } |
| 3155 | 3157 | ||
| @@ -6078,6 +6080,15 @@ change_frame_size (struct frame *f, int new_width, int new_height, | |||
| 6078 | else | 6080 | else |
| 6079 | 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); |
| 6080 | } | 6082 | } |
| 6083 | |||
| 6084 | /* Return non-zero if we delayed size-changes and haven't handled them | ||
| 6085 | yet, which means we cannot be sure about the exact dimensions of our | ||
| 6086 | frames. */ | ||
| 6087 | bool | ||
| 6088 | frame_size_change_delayed (void) | ||
| 6089 | { | ||
| 6090 | return delayed_size_change; | ||
| 6091 | } | ||
| 6081 | 6092 | ||
| 6082 | /*********************************************************************** | 6093 | /*********************************************************************** |
| 6083 | Terminal Related Lisp Functions | 6094 | Terminal Related Lisp Functions |