Cocoa_ShowMessageBox() should call Cocoa_RegisterApp().
authorRyan C. Gordon <icculus@icculus.org>
Fri, 02 Nov 2012 16:48:47 -0400
changeset 6639 c7e81fae23c4
parent 6638 3d221da309d3
child 6640 44a2e00e7c66
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
src/video/cocoa/SDL_cocoamessagebox.m
--- a/src/video/cocoa/SDL_cocoaevents.m	Fri Nov 02 15:22:37 2012 -0400
+++ b/src/video/cocoa/SDL_cocoaevents.m	Fri Nov 02 16:48:47 2012 -0400
@@ -156,6 +156,7 @@
 void
 Cocoa_RegisterApp(void)
 {
+    /* This can get called more than once! Be careful what you initialize! */
     ProcessSerialNumber psn;
     NSAutoreleasePool *pool;
 
--- a/src/video/cocoa/SDL_cocoamessagebox.m	Fri Nov 02 15:22:37 2012 -0400
+++ b/src/video/cocoa/SDL_cocoamessagebox.m	Fri Nov 02 16:48:47 2012 -0400
@@ -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];