We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2176 - SDL_CreateWindow(w=INT_MAX, h=INT_MAX) causes program to hang
Summary: SDL_CreateWindow(w=INT_MAX, h=INT_MAX) causes program to hang
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 2.0.0
Hardware: x86_64 Mac OS X 10.7
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-23 12:48 UTC by Andrew Church
Modified: 2013-11-11 03:20 UTC (History)
0 users

See Also:


Attachments
createwindow-crash.c (244 bytes, text/plain)
2013-10-23 12:48 UTC, Andrew Church
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Church 2013-10-23 12:48:55 UTC
Created attachment 1394 [details]
createwindow-crash.c

I have a unit test which (eventually) calls SDL_CreateWindow() with width and height set to INT_MAX (0x7FFFFFFF).  In SDL 1.2.15, the equivalent SDL_SetVideoMode() call failed as expected, but in SDL 2.0.0 on OSX 10.7.5,  SDL_CreateWindow() causes the program to hang with the following log output:

<Error>: kCGErrorRangeCheck: CGSNewWindowWithOpaqueShape: Cannot create window
<Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
Error (1007) creating CGSWindow on line 263

I don't expect the window creation call to actually succeed (: but I do expect it to return failure rather than hang.

I've attached a short program demonstrating the bug.  For some reason, the program crashes with a backtrace rather than hanging, but it still doesn't complete the SDL_CreateWindow() call.  Incidentally, the call succeeds if I set an absolute position for the window instead of SDL_WINDOWPOS_UNDEFINED or SDL_WINDOWPOS_CENTERED.

I haven't tested this against HG, but I looked over the log and didn't see any changes that appeared relevant.
Comment 1 Sam Lantinga 2013-11-11 01:42:18 UTC
It was bad program termination due to an unhandled exception.

This is fixed, thanks!
https://hg.libsdl.org/SDL/rev/57c34a54b7c2
Comment 2 Andrew Church 2013-11-11 02:29:26 UTC
Thanks for the fix!

>+    @catch (NSException *e) {
>+        SDL_SetError("%s", [[e reason] UTF8String]);
>+        return -1;
>+    }

It looks like you need a [pool release] here?  Or do I just not understand autorelease pools?

Side note: when I run this same unit test using Win32 SDL2 under Wine on Linux, it crashes the entire X server.  That is probably not SDL's fault (: but I'll investigate further and open a new bug if appropriate.
Comment 3 Sam Lantinga 2013-11-11 03:20:08 UTC
Oh, you're right, I need to release the pool.  Thanks for catching that.
Comment 4 Sam Lantinga 2013-11-11 03:20:21 UTC
Oh, you're right, I need to release the pool.  Thanks for catching that.