Fix fullscreen crash on macOS (bug#28496)
authorAlan Third <alan@idiocy.org>
Sat, 30 Sep 2017 23:06:23 +0000 (00:06 +0100)
committerAlan Third <alan@idiocy.org>
Sat, 7 Oct 2017 20:57:16 +0000 (21:57 +0100)
* lisp/frame.el (toggle-frame-fullscreen): Wait for animation to
complete on macOS.

lisp/frame.el

index e501daefb4c084fbac3a537635d8a24e32873c44..7b57aa3df1ff7e45c75abe17889d3858b9406626 100644 (file)
@@ -2434,7 +2434,11 @@ See also `toggle-frame-maximized'."
              (set-frame-parameter nil 'fullscreen fullscreen-restore)
            (set-frame-parameter nil 'fullscreen nil)))
       (modify-frame-parameters
-       nil `((fullscreen . fullboth) (fullscreen-restore . ,fullscreen))))))
+       nil `((fullscreen . fullboth) (fullscreen-restore . ,fullscreen))))
+    ;; Manipulating a frame without waiting for the fullscreen
+    ;; animation to complete can cause a crash, or other unexpected
+    ;; behaviour, on macOS (bug#28496).
+    (when (featurep 'cocoa) (sit-for 1))))
 \f
 ;;;; Key bindings