From: martin rudalics via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Daniel Clemente <n142857@gmail.com>, Eli Zaretskii <eliz@gnu.org>
Cc: 73022@debbugs.gnu.org
Subject: bug#73022: 31.0.50; Crash in build_frame_matrix_from_leaf_window after C-x 2 and reducing terminal size
Date: Sun, 8 Sep 2024 16:58:45 +0200 [thread overview]
Message-ID: <2d8e4603-5ea6-41e9-abfe-461392f717db@gmx.at> (raw)
In-Reply-To: <CAJKAhPApQOrWm8ge+kp7RMNjn9aq=-FSo5aCY_1gheRwGi5zOQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1378 bytes --]
> I can cause the build_frame_matrix_from_leaf_window failed assertion (
> glyph_row_slice_p(window_row, frame_row) is false ) when slowly
> resizing row by row (7→6→5 rows). The number of columns doesn't matter
> (can be a normal one).
>
> You can also try maximizing/unmaximizing“the window if you window
> manager supports it. That's a way of suddenly changing the number of
> rows from a normal value (e.g. 20) to a dangerous value (e.g. 4).
> After unmaximizing it immediately crashes (if you did the C-x 2
> split).
Please try the attached diff (from my heavily edited copy of master, if
it doesn't apply cleanly, complain immediately rather than messing up
your Emacs). It should fix two silly bugs in window.el that make a
frame's safe minimum size much too large and includes the fix I proposed
earlier here.
And it moves the assignment of FrameRows to handle_window_change_signal
in dispnew.c. Doing it in adjust_frame_size was silly (as Gerd Möllmann
noticed earlier). FrameRows should be the height of the tty which can
be smaller than the height of our frame. Emacs is supposed to store it
but not to modify it according to our capabilities.
The patch does not fix the cmcheckmagic problem but makes it much less
likely to occur. And redisplay of an insanely small tty window looks
much better here.
martin
[-- Attachment #2: terminal-resize.diff --]
[-- Type: text/x-patch, Size: 4145 bytes --]
diff --git a/lisp/window.el b/lisp/window.el
index f4226fa4428..e648ccb270a 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -1692,9 +1692,10 @@ window--min-size-1
0
(window-min-pixel-height window)))
(max (ceiling pixel-height char-size)
- (if (window--min-size-ignore-p window ignore)
- 0
- window-min-height))))))))))
+ (cond
+ ((window--min-size-ignore-p window ignore) 0)
+ ((window-minibuffer-p window) 1)
+ (t window-min-height)))))))))))
(defun window-sizable (window delta &optional horizontal ignore pixelwise)
"Return DELTA if DELTA lines can be added to WINDOW.
@@ -1888,7 +1889,7 @@ frame-windows-min-size
(mini (window-next-sibling root)))
(+ (window-min-size root horizontal ignore pixelwise)
(if (and mini (not horizontal))
- (window-min-size mini horizontal nil pixelwise)
+ (window-min-size mini horizontal ignore pixelwise)
0))))
(defun window--max-delta-1 (window delta &optional horizontal ignore trail noup pixelwise)
diff --git a/src/dispnew.c b/src/dispnew.c
index 1a243079e46..8a57866d3ed 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -6054,6 +6054,11 @@ change_frame_size_1 (struct frame *f, int new_width, int new_height,
adjust_frame_size (f, FRAME_PIXEL_TO_TEXT_WIDTH (f, new_width),
FRAME_PIXEL_TO_TEXT_HEIGHT (f, new_height), 5,
pretend, Qchange_frame_size);
+ if ((FRAME_TERMCAP_P (f) && !pretend) || FRAME_MSDOS_P (f))
+ {
+ FrameRows (FRAME_TTY (f)) = new_height;
+ FrameCols (FRAME_TTY (f)) = new_width;
+ }
}
}
diff --git a/src/frame.c b/src/frame.c
index 7f4bf274ad9..9908ec307f7 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -827,14 +827,26 @@ adjust_frame_size (struct frame *f, int new_text_width, int new_text_height,
new_text_lines = dos_new_text_lines - FRAME_TOP_MARGIN (f);
#endif
+ /* Assign new sizes. Do it here to make sure that frame based
+ redisplay gets congruent sizes for the dimensions of the frame
+ matrix and the combined window matrices. */
+ FRAME_COLS (f) = new_text_cols;
+ FRAME_LINES (f) = new_text_lines;
+ FRAME_TEXT_WIDTH (f) = new_text_width;
+ FRAME_TEXT_HEIGHT (f) = new_text_height;
+ FRAME_PIXEL_WIDTH (f) = new_native_width;
+ FRAME_PIXEL_HEIGHT (f) = new_native_height;
+ FRAME_TOTAL_COLS (f) = FRAME_PIXEL_WIDTH (f) / FRAME_COLUMN_WIDTH (f);
+ FRAME_TOTAL_LINES (f) = FRAME_PIXEL_HEIGHT (f) / FRAME_LINE_HEIGHT (f);
+
if (new_inner_width != old_inner_width)
{
resize_frame_windows (f, new_inner_width, true);
/* MSDOS frames cannot PRETEND, as they change frame size by
manipulating video hardware. */
- if ((FRAME_TERMCAP_P (f) && !pretend) || FRAME_MSDOS_P (f))
- FrameCols (FRAME_TTY (f)) = new_text_cols;
+/** if ((FRAME_TERMCAP_P (f) && !pretend) || FRAME_MSDOS_P (f)) **/
+/** FrameCols (FRAME_TTY (f)) = new_text_cols; **/
#if defined (HAVE_WINDOW_SYSTEM)
if (WINDOWP (f->tab_bar_window))
@@ -867,22 +879,12 @@ adjust_frame_size (struct frame *f, int new_text_width, int new_text_height,
/* MSDOS frames cannot PRETEND, as they change frame size by
manipulating video hardware. */
- if ((FRAME_TERMCAP_P (f) && !pretend) || FRAME_MSDOS_P (f))
- FrameRows (FRAME_TTY (f)) = new_text_lines + FRAME_TOP_MARGIN (f);
+/** if ((FRAME_TERMCAP_P (f) && !pretend) || FRAME_MSDOS_P (f)) **/
+/** FrameRows (FRAME_TTY (f)) = new_text_lines + FRAME_TOP_MARGIN (f); **/
}
else if (new_text_lines != old_text_lines)
call2 (Qwindow__pixel_to_total, frame, Qnil);
- /* Assign new sizes. */
- FRAME_COLS (f) = new_text_cols;
- FRAME_LINES (f) = new_text_lines;
- FRAME_TEXT_WIDTH (f) = new_text_width;
- FRAME_TEXT_HEIGHT (f) = new_text_height;
- FRAME_PIXEL_WIDTH (f) = new_native_width;
- FRAME_PIXEL_HEIGHT (f) = new_native_height;
- FRAME_TOTAL_COLS (f) = FRAME_PIXEL_WIDTH (f) / FRAME_COLUMN_WIDTH (f);
- FRAME_TOTAL_LINES (f) = FRAME_PIXEL_HEIGHT (f) / FRAME_LINE_HEIGHT (f);
-
{
struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f));
int text_area_x, text_area_y, text_area_width, text_area_height;
next prev parent reply other threads:[~2024-09-08 14:58 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-04 6:09 bug#73022: 31.0.50; Crash in build_frame_matrix_from_leaf_window after C-x 2 and reducing terminal size Daniel Clemente
[not found] ` <handler.73022.B.172543028723315.ack@debbugs.gnu.org>
2024-09-04 6:25 ` bug#73022: Acknowledgement (31.0.50; Crash in build_frame_matrix_from_leaf_window after C-x 2 and reducing terminal size) Daniel Clemente
2024-09-04 7:28 ` bug#73022: 31.0.50; Crash in build_frame_matrix_from_leaf_window after C-x 2 and reducing terminal size martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-04 12:21 ` Eli Zaretskii
2024-09-04 13:23 ` Eli Zaretskii
2024-09-05 8:18 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-05 9:19 ` Eli Zaretskii
2024-09-05 14:46 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-05 14:58 ` Eli Zaretskii
2024-09-05 15:48 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-05 16:05 ` Eli Zaretskii
2024-09-05 16:30 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-05 16:58 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-05 18:41 ` Eli Zaretskii
2024-09-05 18:15 ` Eli Zaretskii
2024-09-08 11:07 ` Daniel Clemente
2024-09-08 14:36 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-05 8:18 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-05 9:18 ` Eli Zaretskii
2024-09-05 14:45 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-05 15:10 ` Eli Zaretskii
2024-09-05 16:27 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-08 11:08 ` Daniel Clemente
2024-09-08 11:31 ` Eli Zaretskii
2024-09-08 14:58 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-09-10 17:43 ` Daniel Clemente
2024-09-11 8:07 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-11 12:22 ` Eli Zaretskii
2024-09-11 14:37 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-11 15:06 ` Eli Zaretskii
2024-09-12 9:49 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-08 11:09 ` Daniel Clemente
2024-09-08 14:43 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-08 15:32 ` Eli Zaretskii
2024-09-08 17:01 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2d8e4603-5ea6-41e9-abfe-461392f717db@gmx.at \
--to=bug-gnu-emacs@gnu.org \
--cc=73022@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=n142857@gmail.com \
--cc=rudalics@gmx.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.