Fwd: several minute delay in closing after calling Screen('Close',window)

Denis Pelli <denis.pelli@...> wrote:
>
> dear mario
> i have a new problem affecting old programs. i recently upgraded Psychtoolbox 3.0.15 and macOS 10.14.1. it's likely that this bug arrived with one of them. The problem is merely cosmetic, not fatal, so I had it for a while before I noticed. I only just noticed it. I'm sure I didn't have it in June.
>

Hi Denis,

there wasn't any change in PTB's OSX display handling / window setup
code in way over a year, so it's certainly yet another Apple macOS
operating system bug, it is a gift that keeps giving, bringing hours
of joy and entertainment.

I didn't observe any such problems with PTB 3.0.15 on OSX 10.13, but
on Mojave on a macMini 2012 it was quite awful. The Matlab version
didn't close even fullscreen windows unless one waits for long or
presses the up-arrow button. Apart from that, visual stimulation
timing on Intel graphics was completely broken, even in the rare cases
when the startup sync tests succeeded, both as detected by PTB's
kernel driver runtime tests, and by external measurement equipment.
Utterly unusable for any stimulation requiring any timing precision.
On Octave usually the startup tests already failed completely. My
suspicion is that something in Mojave's windowing system event
handling is badly broken, but there are no known sane workarounds for
Apples latest trainwreck. As far as insane workarounds go, opening a
figure() window might help to kick event handling out of its lethargy
somehow, at least that got Octave unstuck.

The only change between PTB 3.0.14 and 3.0.15 wrt. macOS is that
3.0.15 is built against the 10.14 Mojave SDK with XCode 10 instead of
the 10.12 Sierra SDK on XCode 8. So this is either a Mojave bug or a
Mojave SDK bug, or both.

I consider macOS 10.14 unsupported atm., given these totally new level
of shoddy - Apple is outdoing itself.
-mario

> My programs run normally, EXCEPT, that when I open and close a small window, the Screen 'Close' command returns immediately, and my program returns to the MATLAB prompt, but the window remains open for between a minute and several minutes.
>
> I've created a short script, below, that reliably produces this problem on my computer.
> Psychtoolbox 3.0.15 - Flavor: beta - Corresponds to SVN Revision 9221
> Mac OS 10.14.1
> MacBook
>
> When I run the program, it correctly runs and returns promptly, and the correct window appears. It should disappear in a few seconds, but instead lingers for minutes after my program has returned to MATLAB. The problem disappears if the window is full-screen.
>
> Any idea what's going on?
> Best
> Denis
>
> % BUG. After calling Screen Close the window persists for several minutes.
>
> % The delay only affects small windows. There is no problem with
>
> % full-screen windows.
>
> disp(PsychtoolboxVersion);
>
> computer=Screen('Computer');
>
> disp(computer.system);
>
> disp(computer.machineName);
>
>
>
> o.screen=0;
>
> o.useFractionOfScreen=0.3;
>
> % o.useFractionOfScreen=0; % Use full-screen window.
>
> white=255;
>
> screenBufferRect=Screen('Rect',o.screen);
>
> if o.useFractionOfScreen==0
>
> r=screenBufferRect;
>
> else
>
> r=round(o.useFractionOfScreen*screenBufferRect);
>
> end
>
> window=Screen('OpenWindow',o.screen,white,r);
>
> Screen('Close',window);
>
>
>