X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a9a4f2295344414e2ee4e3ec27fa5292918dff27..2f70baea2fa2aa1fbcdceb0121eea1cb5c9bedf0:/src/osx/cocoa/msgdlg.mm?ds=sidebyside diff --git a/src/osx/cocoa/msgdlg.mm b/src/osx/cocoa/msgdlg.mm index 296c77ebcc..ad44f55600 100644 --- a/src/osx/cocoa/msgdlg.mm +++ b/src/osx/cocoa/msgdlg.mm @@ -49,6 +49,13 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent, const wxPoint& WXUNUSED(pos)) : wxMessageDialogBase(parent, message, caption, style) { + m_sheetDelegate = [[ModalDialogDelegate alloc] init]; + [(ModalDialogDelegate*)m_sheetDelegate setImplementation: this]; +} + +wxMessageDialog::~wxMessageDialog() +{ + [m_sheetDelegate release]; } int wxMessageDialog::ShowModal() @@ -167,9 +174,7 @@ void wxMessageDialog::ShowWindowModal() if (parentWindow) { NSWindow* nativeParent = parentWindow->GetWXWindow(); - ModalDialogDelegate* sheetDelegate = [[ModalDialogDelegate alloc] init]; - [sheetDelegate setImplementation: this]; - [alert beginSheetModalForWindow: nativeParent modalDelegate: sheetDelegate + [alert beginSheetModalForWindow: nativeParent modalDelegate: m_sheetDelegate didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:) contextInfo: nil]; }