all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: martin rudalics <rudalics@gmx.at>
Cc: 30320@debbugs.gnu.org, jake.goulding@gmail.com
Subject: bug#30320: 26.0.91; Crash when using lsp-ui-doc-mode
Date: Sat, 10 Feb 2018 12:14:36 +0200	[thread overview]
Message-ID: <83mv0h2ltf.fsf@gnu.org> (raw)
In-Reply-To: <5A797560.9000602@gmx.at> (message from martin rudalics on Tue, 06 Feb 2018 10:29:04 +0100)

> Date: Tue, 06 Feb 2018 10:29:04 +0100
> From: martin rudalics <rudalics@gmx.at>
> CC: 30320@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;
 }
 
 





  reply	other threads:[~2018-02-10 10:14 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-01 15:10 bug#30320: 26.0.91; Crash when using lsp-ui-doc-mode Jake Goulding
2018-02-01 17:16 ` Eli Zaretskii
2018-02-01 19:52   ` Jake Goulding
2018-02-01 19:54     ` Jake Goulding
2018-02-02  8:21     ` Eli Zaretskii
2018-02-02 16:22       ` Jake Goulding
2018-02-03  9:04         ` martin rudalics
2018-02-03 16:10           ` Jake Goulding
2018-02-03 16:34             ` Eli Zaretskii
2018-02-03 19:43               ` Jake Goulding
2018-02-03 20:10                 ` Eli Zaretskii
2018-02-03 21:55                   ` Jake Goulding
2018-02-04 18:35                     ` Eli Zaretskii
2018-02-04 21:08                       ` Jake Goulding
2018-02-04 21:38                         ` Jake Goulding
2018-02-05 17:03                           ` Eli Zaretskii
2018-02-05 18:43                             ` Jake Goulding
2018-02-05 20:14                               ` Eli Zaretskii
2018-02-06  9:29                             ` martin rudalics
2018-02-10 10:14                               ` Eli Zaretskii [this message]
2018-02-10 10:45                                 ` martin rudalics
2018-02-10 12:11                                   ` Eli Zaretskii
2018-02-10 13:40                                     ` martin rudalics
2018-02-10 16:38                                       ` Eli Zaretskii
2018-02-11  9:36                                         ` martin rudalics
2018-02-11 15:43                                           ` Eli Zaretskii
2018-02-12  1:31                                             ` Jake Goulding
2018-02-12  1:33                                               ` Jake Goulding
2018-02-12  1:48                                                 ` Jake Goulding
2018-02-12  9:24                                                   ` martin rudalics
2019-10-30 11:06                                                     ` Lars Ingebrigtsen
2018-02-12  9:22                                                 ` martin rudalics
2018-02-12  9:22                                               ` martin rudalics
2018-02-12  9:22                                             ` martin rudalics
2018-02-12 18:04                                               ` Eli Zaretskii
2018-02-10 19:04                                 ` Jake Goulding
2018-02-02  8:27 ` martin rudalics

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=83mv0h2ltf.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=30320@debbugs.gnu.org \
    --cc=jake.goulding@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.