From e61922b4c738e09043f6aad4d058689261c853fb Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Wed, 7 Jun 2017 13:55:09 +0200 Subject: [PATCH] using return code properly even when using CFUserNotification in non-gui thread, rearranging [alert release] so that callback does not get a zombie as a parameter --- src/osx/cocoa/msgdlg.mm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/osx/cocoa/msgdlg.mm b/src/osx/cocoa/msgdlg.mm index 65e56b2e78..aca46d1541 100644 --- a/src/osx/cocoa/msgdlg.mm +++ b/src/osx/cocoa/msgdlg.mm @@ -71,8 +71,6 @@ int wxMessageDialog::ShowModal() wxCFEventLoopPauseIdleEvents pause; - int resultbutton = wxID_CANCEL; - const long style = GetMessageDialogStyle(); wxASSERT_MSG( (style & 0x3F) != wxYES, wxT("this style is not supported on Mac") ); @@ -156,7 +154,9 @@ int wxMessageDialog::ShowModal() 0, alertType, NULL, NULL, NULL, cfTitle, cfText, defaultButtonTitle, alternateButtonTitle, otherButtonTitle, &exitButton ); if (err == noErr) - resultbutton = m_buttonId[exitButton]; + SetReturnCode( m_buttonId[exitButton] ); + else + SetReturnCode( wxID_CANCEL ); } else { @@ -164,8 +164,8 @@ int wxMessageDialog::ShowModal() int button = -1; button = [alert runModal]; - [alert release]; ModalFinishedCallback(alert, button); + [alert release]; } return GetReturnCode();