GNU bug report logs - #65025
Possible race in make-frame

Previous Next

Package: emacs;

Reported by: Anders Blomdell <anders.blomdell <at> control.lth.se>

Date: Wed, 2 Aug 2023 17:38:02 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Anders Blomdell <anders.blomdell <at> control.lth.se>
To: 65025 <at> debbugs.gnu.org
Subject: bug#65025: Possible race in make-frame
Date: Wed, 2 Aug 2023 16:02:06 +0200
When running

  /usr/bin/emacsclient --eval '(make-frame)'

it sometimes (often) opens up a small window (10x21) instead of the expected 40x80 window.

Setting a hook for after-make-frame-functions like this:

(progn
  (setq after-make-frame-functions nil)
  (add-hook
   'after-make-frame-functions
   (lambda (frame)
     (let ((width 80)
           (height 40)
           (start-width (frame-width frame))
           (start-height (frame-height frame))
           (visible (frame-visible-p frame)))
       (print (format "Start %dx%d %S"
                      start-height start-width visible))
       (if (not visible)
           (progn
             (while
                 (not (frame-visible-p frame))
               (progn
                 (sleep-for 0.001)
                 (print (format "X %dx%d"
                                (frame-height frame)
                                (frame-width frame)))
                 ))
             (sleep-for 0.001)
             (print (format "Resetting %dx%d -> %dx%d"
                            (frame-height frame) (frame-width frame)
                            height width))
             (set-frame-width frame width)
             (set-frame-height frame height)
             (sleep-for 0.1)
             (print (format "Resetting %dx%d -> %dx%d"
                            (frame-height frame) (frame-width frame)
                            height width))
             (set-frame-width frame width)
             (set-frame-height frame height)
             )
             )
         )
       (print (format "Done %dx%d"
                      (frame-height frame)
                      (frame-width frame)))
       )
   )
  )



usually has two different outcomes:

  "Start 10x38 t"
  "Done 10x38"

or

  "Start 40x80 nil"
  "X 40x80"
  "X 40x80"
  "X 40x80"
  "X 10x21"
  "Resetting 10x21 -> 40x80"
  "Resetting 40x80 -> 40x80"
  "Done 40x80"





-- 
Anders Blomdell                  Email: anders.blomdell <at> control.lth.se
Department of Automatic Control
Lund University                  Phone:    +46 46 222 8793
P.O. Box 118
SE-221 00 Lund, Sweden




This bug report was last modified 2 years and 13 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.