Fixed bug 1682 - Resize collapses window instantly to a size of 0 x 124.
authorSam Lantinga <slouken@libsdl.org>
Fri, 08 Feb 2013 01:04:07 -0800
changeset 6837a69e10925a58
parent 6836 b0ca1571caf3
child 6838 abd1407af1f9
Fixed bug 1682 - Resize collapses window instantly to a size of 0 x 124.

Marco Schmidt

After sizing my main window (the only window in my application) through
grabbing the window border with the mouse the window collapses instantly to a
size of 0 x 124. In my application I can not resize the window to a normal size
again.

I tried to reproduce the problem - and here a the minimal steps I found.

I'm running WIN8 x64, VS2012Pro, HG SDL-2.0 tip, WIN32-Build.

Minimal steps to reproduce my problem:

- open solution SDL_VS2012
- make testdraw2 the start project
- pass command line option --resize to the debuggee testdraw2
- starting the application testdraw2
- try to resize the window
- the application window resizes to a minimal size 0 x 124.
- the application crashes to divide by zero .... (this is only the aftermath
but a unhandled error condition)
src/video/windows/SDL_windowsevents.c
     1.1 --- a/src/video/windows/SDL_windowsevents.c	Fri Feb 08 00:54:08 2013 -0800
     1.2 +++ b/src/video/windows/SDL_windowsevents.c	Fri Feb 08 01:04:07 2013 -0800
     1.3 @@ -469,8 +469,10 @@
     1.4                 size so we don't need to call AdjustWindowRectEx twice */
     1.5              min_w -= w;
     1.6              min_h -= h;
     1.7 -            max_w -= w;
     1.8 -            max_h -= h;
     1.9 +            if (max_w && max_h) {
    1.10 +                max_w -= w;
    1.11 +                max_h -= h;
    1.12 +            }
    1.13  
    1.14              size.top = 0;
    1.15              size.left = 0;