From fd7e6d4cf2efc408b32702299003ff0a384a2c2e Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 2 Nov 2012 16:48:47 -0400 Subject: [PATCH] Cocoa_ShowMessageBox() should call Cocoa_RegisterApp(). Otherwise, message boxes can fail if SDL_Init(SDL_INIT_VIDEO) wasn't completed. --- src/video/cocoa/SDL_cocoaevents.m | 1 + src/video/cocoa/SDL_cocoamessagebox.m | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/video/cocoa/SDL_cocoaevents.m b/src/video/cocoa/SDL_cocoaevents.m index cf90d5dcb..0c42828f1 100644 --- a/src/video/cocoa/SDL_cocoaevents.m +++ b/src/video/cocoa/SDL_cocoaevents.m @@ -156,6 +156,7 @@ - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filenam void Cocoa_RegisterApp(void) { + /* This can get called more than once! Be careful what you initialize! */ ProcessSerialNumber psn; NSAutoreleasePool *pool; diff --git a/src/video/cocoa/SDL_cocoamessagebox.m b/src/video/cocoa/SDL_cocoamessagebox.m index 6dc8a2a14..7a30d5047 100644 --- a/src/video/cocoa/SDL_cocoamessagebox.m +++ b/src/video/cocoa/SDL_cocoamessagebox.m @@ -37,6 +37,8 @@ int Cocoa_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) { + Cocoa_RegisterApp(); + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSAlert* alert = [[NSAlert alloc] init];