Subject: Re: bug#17876: 24.3; Incorrect frame resize

From: Lars Ingebrigtsen <[email-masked]>
Date: Fri, 04 Dec 2020 12:46:37 +0100

penthief <[email-masked]> writes:

> When setting the a font on a frame after a resize, there is an apparent
> race condition that more often than not, causes the frame height
> and/or width to be reset to an incorrect value.
>
> This behaviour also occurs on 24.3.92.
>
> 1. Create a file bug-frame-resize.el with the following contents
> (assuming that Courier and Monaco are present on the system).
>
> (setq -last-used-font nil)
> (setq -target-font-1 "Courier")
> (setq -target-font-2 "Monaco")
> (setq -target-height 5)
> (setq -target-width 5)
>
> (defun bug-frame-resize ()
>   (interactive)
>   (with-selected-frame (make-frame)
>     (set-frame-width (selected-frame) -target-width)
>     (set-frame-height (selected-frame) -target-height)
>     (let ((target-font (if (equal -last-used-font -target-font-1)
> 			   -target-font-2
> 			 -target-font-1)))
>       (setq -last-used-font target-font)
>       (set-frame-font target-font))))
>
> 2. Start emacs
>
> $ /usr/bin/emacs24-x -Q -l bug-frame-resize.el
>
> 3. Type "M-x bug-frame-resize" four or five times.
>
> The frames appear with the correct size briefly, but then resize after
> a split second. On this machine this usually results one of the height
> or width is incorrect on each of the created frames.

(This bug report unfortunately got no response at the time.)

I tried reproducing this in Emacs 28 on Debian/bullseye, but was unable
to.  All the Monaco frames have the exact same width/height, and so do
all the Courier frames.

Do you still see this issue in more recent Emacs versions?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no