unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Po Lu <luangruo@yahoo.com>
Cc: mwd@md5i.com, 56561@debbugs.gnu.org
Subject: bug#56561: 29.0.50; Infloop in try_window
Date: Sat, 16 Jul 2022 09:33:17 +0300	[thread overview]
Message-ID: <83zgh9r2he.fsf@gnu.org> (raw)
In-Reply-To: <87v8rxk3eb.fsf@yahoo.com> (message from Po Lu on Sat, 16 Jul 2022 13:55:24 +0800)

> From: Po Lu <luangruo@yahoo.com>
> Cc: mwd@md5i.com,  56561@debbugs.gnu.org
> Date: Sat, 16 Jul 2022 13:55:24 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > What I had in mind is an assertion in x-show-tip that the glyph matrix
> > produced by try_window includes all of the tooltip text, i.e. that
> > there's a glyph row there whose ends_at_zv_p flag is set.  This is an
> > indication that all of the text was processed and will appear in the
> > tooltip.
> >
> > Note that in the case in point this is precisely what's happened: the
> > entire text of the tip was processed and produced its glyphs, and the
> > problem happened while try_window was producing empty glyph rows
> > beyond ZV.
> 
> Thanks, but we can't guarantee that the tooltip frame's window is large
> enough to hold the entire contents of the tooltip buffer.  The size can
> be changed (on various different platforms) by the window manager or the
> toolkit.

If the window manager changes the size of the window, we won't know
that in try_window, because the code which creates the window-system
window runs _after_ try_window.  The dimensions of the Emacs window
for which we invoke try_window and of its frame are determined by our
code:

  if (CONSP (Vx_max_tooltip_size)
      && RANGED_FIXNUMP (1, XCAR (Vx_max_tooltip_size), INT_MAX)
      && RANGED_FIXNUMP (1, XCDR (Vx_max_tooltip_size), INT_MAX))
    {
      w->total_cols = XFIXNAT (XCAR (Vx_max_tooltip_size));
      w->total_lines = XFIXNAT (XCDR (Vx_max_tooltip_size));
    }
  else
    {
      w->total_cols = 80;
      w->total_lines = 40;
    }

  w->pixel_width = w->total_cols * FRAME_COLUMN_WIDTH (tip_f);
  w->pixel_height = w->total_lines * FRAME_LINE_HEIGHT (tip_f);
  FRAME_TOTAL_COLS (tip_f) = WINDOW_TOTAL_COLS (w);
  adjust_frame_glyphs (tip_f);

Or maybe I don't understand what you mean by "the size can be changed
by the window manager", please explain and show the code to which you
allude.

As for toolkits: we don't use this code when toolkit tooltips are
used.

> > No, because as I explained in my message, I don't think this should
> > be needed.  If the above assertion ever triggers, we will see what
> > kind of situation causes it, and can then discuss solutions.
> 
> How about simply asserting that try_window never returns 0?

That would trigger unnecessarily, creating false positives.  The
situation that started this bug report is one such case: my fix will
cause try_window to return zero in that case.  But if the entire text
was processed and is in the glyph matrix, that zero return value
doesn't mean a failure.





  reply	other threads:[~2022-07-16  6:33 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-14 18:57 bug#56561: 29.0.50; Infloop in try_window Michael Welsh Duggan
2022-07-14 19:28 ` Eli Zaretskii
2022-07-14 22:44   ` Michael Welsh Duggan
2022-07-15  6:14     ` Eli Zaretskii
2022-07-15 10:52       ` Eli Zaretskii
2022-07-15 13:54         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-15 14:24           ` Eli Zaretskii
2022-07-15 15:27             ` Eli Zaretskii
2022-07-15 15:37               ` Eli Zaretskii
2022-07-15 15:56                 ` Eli Zaretskii
2022-07-16  3:15                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-16  5:50                     ` Eli Zaretskii
2022-07-16  5:55                       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-16  6:33                         ` Eli Zaretskii [this message]
2022-07-16  6:42                           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-16  7:32                             ` Eli Zaretskii
2022-07-16  8:22                               ` Eli Zaretskii
2022-07-16  8:47                               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-16  8:59                                 ` Eli Zaretskii
2022-07-16 10:34                                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-16 10:57                                     ` Eli Zaretskii
2022-07-16 11:07                                       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-16 11:45                                         ` Eli Zaretskii
2022-07-16 12:34                                           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-16 12:38                                             ` Eli Zaretskii
2022-07-17  0:45                                               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-17  5:43                                                 ` Eli Zaretskii
2022-07-17  6:29                                                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-17  6:40                                                     ` Eli Zaretskii
2022-07-17  7:43                                                       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-17 13:29                                                         ` Eli Zaretskii
2022-07-18  0:57                                                           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-18 12:37                                                             ` Eli Zaretskii
2022-07-19  0:54                                                               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-21  7:14                                                                 ` Eli Zaretskii
2022-07-21  8:17                                                                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-16  3:14                 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-16  3:11               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-16  3:07             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-15 14:03         ` Michael Welsh Duggan

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83zgh9r2he.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=56561@debbugs.gnu.org \
    --cc=luangruo@yahoo.com \
    --cc=mwd@md5i.com \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).