[Bf-blender-cvs] [57d7e5b6ee8] master: Fix T42489 and T52936: Loading blend with minimized window results in crash or empty screen on windows.

Ray Molenkamp noreply at git.blender.org
Wed Oct 4 19:44:31 CEST 2017


Commit: 57d7e5b6ee8e8061f964321edec48584fc64ab03
Author: Ray Molenkamp
Date:   Wed Oct 4 11:44:22 2017 -0600
Branches: master
https://developer.blender.org/rB57d7e5b6ee8e8061f964321edec48584fc64ab03

Fix T42489 and T52936: Loading blend with minimized window results in crash or empty screen on windows.

Reviewed By: @brecht , @sergey

Differential Revision: http://developer.blender.org/D2866

===================================================================

M	intern/ghost/intern/GHOST_WindowWin32.cpp
M	source/blender/windowmanager/intern/wm_window.c

===================================================================

diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp
index 7ac54e5c915..abf3c8672ff 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -402,21 +402,29 @@ void GHOST_WindowWin32::getClientBounds(GHOST_Rect &bounds) const
 {
 	RECT rect;
 	POINT coord;
-	::GetClientRect(m_hWnd, &rect);
+	if (!IsIconic(m_hWnd)) {
+		::GetClientRect(m_hWnd, &rect);
 
-	coord.x = rect.left;
-	coord.y = rect.top;
-	::ClientToScreen(m_hWnd, &coord);
+		coord.x = rect.left;
+		coord.y = rect.top;
+		::ClientToScreen(m_hWnd, &coord);
 
-	bounds.m_l = coord.x;
-	bounds.m_t = coord.y;
+		bounds.m_l = coord.x;
+		bounds.m_t = coord.y;
 
-	coord.x = rect.right;
-	coord.y = rect.bottom;
-	::ClientToScreen(m_hWnd, &coord);
+		coord.x = rect.right;
+		coord.y = rect.bottom;
+		::ClientToScreen(m_hWnd, &coord);
 
-	bounds.m_r = coord.x;
-	bounds.m_b = coord.y;
+		bounds.m_r = coord.x;
+		bounds.m_b = coord.y;
+	}
+	else {
+		bounds.m_b = 0;
+		bounds.m_l = 0;
+		bounds.m_r = 0;
+		bounds.m_t = 0;
+	}
 }
 
 
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 9fe215f7712..79078b321da 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -477,8 +477,12 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wm
 		
 		/* store actual window size in blender window */
 		bounds = GHOST_GetClientBounds(win->ghostwin);
-		win->sizex = GHOST_GetWidthRectangle(bounds);
-		win->sizey = GHOST_GetHeightRectangle(bounds);
+
+		/* win32: gives undefined window size when minimized */
+		if (GHOST_GetWindowState(win->ghostwin) != GHOST_kWindowStateMinimized) {
+			win->sizex = GHOST_GetWidthRectangle(bounds);
+			win->sizey = GHOST_GetHeightRectangle(bounds);
+		}
 		GHOST_DisposeRectangle(bounds);
 		
 #ifndef __APPLE__



More information about the Bf-blender-cvs mailing list