From cbc7b99053d3331a88441887f0bd61010584c002 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Sun, 19 Nov 2006 13:20:04 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=11550 --- checkin_notes | 3 +++ clientgui/BOINCGUIApp.cpp | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/checkin_notes b/checkin_notes index 3198843655..ba2febe5b4 100755 --- a/checkin_notes +++ b/checkin_notes @@ -12692,7 +12692,10 @@ Bruce 19 Nov 2006 Charlie 19 Nov 2006 - MGR: Fix windows compile errors. + - Mac: Ignore Quit AppleEvents if a modal dialog is open (to prevent + crashes if the user selects Quit from the Manager's Dock menu.) clientgui/ + BOINCGUIApp.cpp sg_ProjectsComponent.cpp ViewMessages.cpp diff --git a/clientgui/BOINCGUIApp.cpp b/clientgui/BOINCGUIApp.cpp index 829fc357db..25833521eb 100644 --- a/clientgui/BOINCGUIApp.cpp +++ b/clientgui/BOINCGUIApp.cpp @@ -805,6 +805,8 @@ OSErr CBOINCGUIApp::QuitAppleEventHandler( const AppleEvent *appleEvt, AppleEven Boolean isSame; ProcessInfoRec pInfo; FSSpec fileSpec; + WindowRef win; + WindowModality modality; OSStatus anErr; anErr = AEGetAttributePtr(appleEvt, keyAddressAttr, typeProcessSerialNumber, @@ -824,6 +826,16 @@ OSErr CBOINCGUIApp::QuitAppleEventHandler( const AppleEvent *appleEvt, AppleEven pInfo.processAppSpec = &fileSpec; anErr = GetProcessInformation(&SenderPSN, &pInfo); + + // Refuse to quit if a modal dialog is open + win = FrontWindow(); + if (win) { + GetWindowModality(win, &modality, NULL); + if (modality == kWindowModalityAppModal) { + SysBeep(4); + return userCanceledErr; + } + } // Consider a Quit command from our Dock menu as coming from this application if (pInfo.processSignature != 'dock') {