Cocoa_ShowMessageBox() should call Cocoa_RegisterApp().
authorRyan C. Gordon <icculus@icculus.org>
Fri, 02 Nov 2012 16:48:47 -0400
changeset 6639c7e81fae23c4
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
     1.1 --- a/src/video/cocoa/SDL_cocoaevents.m	Fri Nov 02 15:22:37 2012 -0400
     1.2 +++ b/src/video/cocoa/SDL_cocoaevents.m	Fri Nov 02 16:48:47 2012 -0400
     1.3 @@ -156,6 +156,7 @@
     1.4  void
     1.5  Cocoa_RegisterApp(void)
     1.6  {
     1.7 +    /* This can get called more than once! Be careful what you initialize! */
     1.8      ProcessSerialNumber psn;
     1.9      NSAutoreleasePool *pool;
    1.10  
     2.1 --- a/src/video/cocoa/SDL_cocoamessagebox.m	Fri Nov 02 15:22:37 2012 -0400
     2.2 +++ b/src/video/cocoa/SDL_cocoamessagebox.m	Fri Nov 02 16:48:47 2012 -0400
     2.3 @@ -37,6 +37,8 @@
     2.4  int
     2.5  Cocoa_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
     2.6  {
     2.7 +    Cocoa_RegisterApp();
     2.8 +
     2.9      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    2.10  
    2.11      NSAlert* alert = [[NSAlert alloc] init];