FIXED: Error with SCREEN('Closeall');

http://groups.yahoo.com/group/psychtoolbox/message/845

In message 845, Charles Collins wrote:

>If one
>calls INPUTDLG after opening a SCREEN window, attempts to clear that
>window lead to the error. Here's a minimal script that produces the
>error:
>
>win = SCREEN(0, 'OpenWindow');
>MyInfo = INPUTDLG('Enter: ', 'Input', 1, {'test'});
>SCREEN('CloseAll');
>
>When I hit "Okay", I get the following error information:
>
>??? Double trouble! An error occurred while restoring screens to report
>another error.
>GDOpenWindow.c 530: GDDisposeWindow can't dispose of window while it's the
>current port.

I did some debugging. It seems that this is a bug in MATLAB. It seems
that INPUTDLG and QUESTDLG fail to restore the current port, instead
making SCREEN's window the current port.

I added code to SCREEN's OpenWindow, Close, and CloseAll that looks for
this problem and works around it. When the current port is valid, we save
it, and when it's invalid we restore it from the last known good value.
This seems to work flawlessly, cleaning up MATLAB's sloppiness with no
side effects.

A new version of SCREEN.mex is enclosed. OpenDLGCloseTest.m shows that
the bug is gone.

A new release is imminent (around end of the march), and will include
this new version of SCREEN.mex.

best

denis

p.s.
you may need stuffit expander (free for all platforms) to unpack the
enclosure:
http://www.stuffit.com/expander/

NOTE TO ALL: denis.pelli@... is my preferred email address. Please
use that address. My "verizon.net" address will go away soon, partly
because Verizon forces me to use that as my "From:" address. My current
email program won't allow me to designate a separate "Reply-to:" address.