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 7946 57c34a54b7c2
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
--- a/src/video/cocoa/SDL_cocoawindow.m	Sun Nov 10 20:38:50 2013 -0300
+++ b/src/video/cocoa/SDL_cocoawindow.m	Sun Nov 10 17:40:35 2013 -0800
@@ -748,7 +748,14 @@
             rect.origin.y -= screenRect.origin.y;
         }
     }
-    nswindow = [[SDLWindow alloc] initWithContentRect:rect styleMask:style backing:NSBackingStoreBuffered defer:NO screen:screen];
+
+    @try {
+        nswindow = [[SDLWindow alloc] initWithContentRect:rect styleMask:style backing:NSBackingStoreBuffered defer:NO screen:screen];
+    }
+    @catch (NSException *e) {
+        SDL_SetError("%s", [[e reason] UTF8String]);
+        return -1;
+    }
     [nswindow setBackgroundColor:[NSColor blackColor]];
 
     /* Create a default view for this window */