From a0d0fae5d6dc532394070d22b3270eeacc6cc5ec Mon Sep 17 00:00:00 2001 From: Mario Kleiner Date: Mon, 3 Jun 2024 18:57:25 +0100 Subject: [PATCH] TwoStateQuery(): Add workaround for broken Matlab R2024a on Apple Silicon macOS. questdlg() is broken on at least R2024a Apple Silicon macOS. Sometimes it works, but most often if one clicks on a dialog button, Matlab hangs in the spinning beach ball of death. No such problem with Matlab on Linux, or with Octave on macOS. Fall back to ugly figure() method for Matlab on macOS ARM for the time being. --- Psychtoolbox/PsychHardware/Daq/Utilities/TwoStateQuery.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Psychtoolbox/PsychHardware/Daq/Utilities/TwoStateQuery.m b/Psychtoolbox/PsychHardware/Daq/Utilities/TwoStateQuery.m index eaa026e5c2..892787d3b6 100644 --- a/Psychtoolbox/PsychHardware/Daq/Utilities/TwoStateQuery.m +++ b/Psychtoolbox/PsychHardware/Daq/Utilities/TwoStateQuery.m @@ -67,7 +67,10 @@ % MK: Always use this one, even on Matlab. I can not see the advantage of % the Matlab specific contraption below? It seems to provide the same % functionality, but with way more ugly formatting? -if IsOctave || 1 +% Except on Matlab for macOS on Apple Silicon, where questdlg() is broken +% as of R2024a - Half of the time it works, the other half clicking on a +% button causes Matlab to hang with the spinning beach ball of death. +if IsOctave || ~(IsOSX && IsARM) button = questdlg(TheQuestion, 'Question', TheChoices{1}, TheChoices{2}, 'Cancel', 'Cancel'); if ~isempty(strfind(button, TheChoices{1})) UserResponse = 1; @@ -91,7 +94,7 @@ PrimeFontSize = 36; QueryFigh = figure('Position',[FigPos FigWidth FigHeight],'Resize','off','NumberTitle','off', ... - 'Name','Cross the Rubicon','MenuBar','none','Color','k'); + 'Name','Question','MenuBar','none','Color','k'); QueryFighNr = QueryFigh; if ~isnumeric(QueryFighNr) QueryFighNr = QueryFigh.Number;