Fixed bug 2176 - SDL_CreateWindow(w=INT_MAX, h=INT_MAX) causes program to hang
authorSam Lantinga <slouken@libsdl.org>
Sun, 10 Nov 2013 17:40:35 -0800
changeset 794657c34a54b7c2
parent 7945 764129077d18
child 7947 f5f51b3c4dd2
Fixed bug 2176 - SDL_CreateWindow(w=INT_MAX, h=INT_MAX) causes program to hang

Catch exceptions generated when trying to create a Cocoa window.
src/video/cocoa/SDL_cocoawindow.m
     1.1 --- a/src/video/cocoa/SDL_cocoawindow.m	Sun Nov 10 20:38:50 2013 -0300
     1.2 +++ b/src/video/cocoa/SDL_cocoawindow.m	Sun Nov 10 17:40:35 2013 -0800
     1.3 @@ -748,7 +748,14 @@
     1.4              rect.origin.y -= screenRect.origin.y;
     1.5          }
     1.6      }
     1.7 -    nswindow = [[SDLWindow alloc] initWithContentRect:rect styleMask:style backing:NSBackingStoreBuffered defer:NO screen:screen];
     1.8 +
     1.9 +    @try {
    1.10 +        nswindow = [[SDLWindow alloc] initWithContentRect:rect styleMask:style backing:NSBackingStoreBuffered defer:NO screen:screen];
    1.11 +    }
    1.12 +    @catch (NSException *e) {
    1.13 +        SDL_SetError("%s", [[e reason] UTF8String]);
    1.14 +        return -1;
    1.15 +    }
    1.16      [nswindow setBackgroundColor:[NSColor blackColor]];
    1.17  
    1.18      /* Create a default view for this window */