GNU bug report logs -
#30320
26.0.91; Crash when using lsp-ui-doc-mode
Previous Next
Reported by: Jake Goulding <jake.goulding <at> gmail.com>
Date: Thu, 1 Feb 2018 16:25:02 UTC
Severity: normal
Found in version 26.0.91
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> Date: Tue, 06 Feb 2018 10:29:04 +0100
> From: martin rudalics <rudalics <at> gmx.at>
> CC: 30320 <at> debbugs.gnu.org
>
> > As for preventing such crashes even though some Lisp does nonsensical
> > things: I think a TTY frame cannot be less than 3 or 4 lines plus the
> > number of lines used for the menu bar. Martin, WDYT about adding
> > these limitations to adjust_frame_size?
>
> A better location is when adjusting min_size in frame_windows_min_size
> here:
>
> int min_size = XINT (par_size);
>
> /* Don't allow phantom frames. */
> if (min_size < 1)
> min_size = 1;
>
> As you see we currently allow 1 here for width and height measured in
> characters. Feel free to change this any way you want -
> FRAME_TERMCAP_P conditioned it shouldn't hurt and be suitable for the
> release version. If you want me to do it, please tell me the value(s)
> you consider appropriate and where to apply it.
>
> I never cared about this because I never was able to crash Emacs when
> using small sizes.
Does the below look reasonable and safe for emacs-26?
Jake, can you see if this patch avoids the crash even with the
original problem in lsp-ui-doc-mode?
diff --git a/src/frame.c b/src/frame.c
index d5b080d..b2bc031 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -349,6 +349,7 @@ frame_windows_min_size (Lisp_Object frame, Lisp_Object horizontal,
{
struct frame *f = XFRAME (frame);
Lisp_Object par_size;
+ int retval;
if ((!NILP (horizontal)
&& NUMBERP (par_size = get_frame_param (f, Qmin_width)))
@@ -361,15 +362,27 @@ frame_windows_min_size (Lisp_Object frame, Lisp_Object horizontal,
if (min_size < 1)
min_size = 1;
- return (NILP (pixelwise)
- ? min_size
- : min_size * (NILP (horizontal)
- ? FRAME_LINE_HEIGHT (f)
- : FRAME_COLUMN_WIDTH (f)));
+ retval = (NILP (pixelwise)
+ ? min_size
+ : min_size * (NILP (horizontal)
+ ? FRAME_LINE_HEIGHT (f)
+ : FRAME_COLUMN_WIDTH (f)));
}
else
- return XINT (call4 (Qframe_windows_min_size, frame, horizontal,
- ignore, pixelwise));
+ retval = XINT (call4 (Qframe_windows_min_size, frame, horizontal,
+ ignore, pixelwise));
+ /* Don't allow too snall height of text-mode frames, or else cm.c
+ might abort in cmcheckmagic. */
+ if ((FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) && NILP (horizontal))
+ {
+ int min_height = (FRAME_MENU_BAR_LINES (f)
+ + FRAME_WANTS_MODELINE_P (f)
+ + 2); /* one text line and one echo-area line */
+ if (retval < min_height)
+ retval = min_height;
+ }
+
+ return retval;
}
This bug report was last modified 5 years and 262 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.