From cbb9c722cbdd6680fa0543a04ae193e0aafe863e Mon Sep 17 00:00:00 2001 From: JulianSmart Date: Tue, 26 May 2015 12:16:23 +0100 Subject: [PATCH] Use OnEndSession/OnQueryEndSession events instead of calling the functions directly. --- src/osx/carbon/app.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/osx/carbon/app.cpp b/src/osx/carbon/app.cpp index bb7e66c9fc..a932b36602 100644 --- a/src/osx/carbon/app.cpp +++ b/src/osx/carbon/app.cpp @@ -259,12 +259,16 @@ short wxApp::MacHandleAEOApp(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNU short wxApp::MacHandleAEQuit(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNUSED(reply)) { - wxCloseEvent event; - wxTheApp->OnQueryEndSession(event); + wxCloseEvent event(wxEVT_QUERY_END_SESSION, wxID_ANY); + event.SetEventObject(this); + event.SetCanVeto(true); + ProcessEvent(event); if ( !event.GetVeto() ) { - wxCloseEvent event; - wxTheApp->OnEndSession(event); + wxCloseEvent event(wxEVT_END_SESSION, wxID_ANY); + event.SetEventObject(this); + event.SetCanVeto(false); + ProcessEvent(event); } return noErr ; } @@ -425,15 +429,18 @@ void wxApp::OSXOnDidFinishLaunching() void wxApp::OSXOnWillTerminate() { - wxCloseEvent event; + wxCloseEvent event(wxEVT_END_SESSION, wxID_ANY); + event.SetEventObject(this); event.SetCanVeto(false); - wxTheApp->OnEndSession(event); + ProcessEvent(event); } bool wxApp::OSXOnShouldTerminate() { - wxCloseEvent event; - wxTheApp->OnQueryEndSession(event); + wxCloseEvent event(wxEVT_QUERY_END_SESSION, wxID_ANY); + event.SetEventObject(this); + event.SetCanVeto(true); + ProcessEvent(event); return !event.GetVeto(); } #endif