From 810fb9e5dea73da7aac50fe86e35ef933daaaa0d Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 8 Feb 2013 01:04:07 -0800 Subject: [PATCH] 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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index e63d7b51c..7f0eef4cc 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -469,8 +469,10 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) size so we don't need to call AdjustWindowRectEx twice */ min_w -= w; min_h -= h; - max_w -= w; - max_h -= h; + if (max_w && max_h) { + max_w -= w; + max_h -= h; + } size.top = 0; size.left = 0;