1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-01 16:19:43 +02:00
audacity/mac/wxMac_additions/tooldock-quit.patch
Paul Licameli ea1015596c Bug1511: REBUILD WXWIDGETS: Mac Quit via tooldock doesn't crash...
... in case at least three projects are open, or skip save prompts either,
in case at least two projects with unsaved changes are open.
2016-10-03 14:38:56 -04:00

58 lines
1.6 KiB
Diff

From 343528d045e805b84e2c4df2bacdf4d319906084 Mon Sep 17 00:00:00 2001
From: Paul Licameli <paul.licameli@audacityteam.org>
Date: Mon, 3 Oct 2016 13:58:26 -0400
Subject: [PATCH] Quitting app via Mac tooldock uses events, so behavior is
overridable
---
src/osx/carbon/app.cpp | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/osx/carbon/app.cpp b/src/osx/carbon/app.cpp
index 0926dbf..bdb78ca 100644
--- src/osx/carbon/app.cpp
+++ src/osx/carbon/app.cpp
@@ -259,12 +259,9 @@ short wxApp::MacHandleAEOApp(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNU
short wxApp::MacHandleAEQuit(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNUSED(reply))
{
- wxCloseEvent event;
- wxTheApp->OnQueryEndSession(event);
- if ( !event.GetVeto() )
+ if ( OSXOnShouldTerminate() )
{
- wxCloseEvent event;
- wxTheApp->OnEndSession(event);
+ OSXOnWillTerminate();
}
return noErr ;
}
@@ -421,15 +418,20 @@ void wxApp::OSXOnDidFinishLaunching()
void wxApp::OSXOnWillTerminate()
{
- wxCloseEvent event;
+ wxCloseEvent event(wxEVT_END_SESSION, wxID_ANY);
+ event.SetEventObject(wxTheApp);
event.SetCanVeto(false);
- wxTheApp->OnEndSession(event);
+
+ wxTheApp->ProcessEvent(event);
}
bool wxApp::OSXOnShouldTerminate()
{
- wxCloseEvent event;
- wxTheApp->OnQueryEndSession(event);
+ wxCloseEvent event(wxEVT_QUERY_END_SESSION, wxID_ANY);
+ event.SetEventObject(wxTheApp);
+ event.SetCanVeto(true);
+
+ wxTheApp->ProcessEvent(event);
return !event.GetVeto();
}
#endif
--
2.3.2 (Apple Git-55)