[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34641] trunk/blender/intern/ghost/intern/ GHOST_WindowWin32.cpp: Fix [#19997] Duplicating window results in graphics corruption in UI

Nathan Letwory nathan at letworyinteractive.com
Fri Feb 4 14:22:03 CET 2011


Revision: 34641
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34641
Author:   jesterking
Date:     2011-02-04 13:22:02 +0000 (Fri, 04 Feb 2011)
Log Message:
-----------
Fix [#19997] Duplicating window results in graphics corruption in UI
reported by Micael Dias (and many others, see duplicates list)

On closing the first ("main") Blender window the very first OpenGL context
got deleted too. This context needs to be retained, since we share quite a
bit of OpenGL data through it to the newly created contexts (new windows).
Thanks to Ton Roosendaal for thinking out loud while trying to figure out
what the actual cause was.

Modified Paths:
--------------
    trunk/blender/intern/ghost/intern/GHOST_WindowWin32.cpp

Modified: trunk/blender/intern/ghost/intern/GHOST_WindowWin32.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_WindowWin32.cpp	2011-02-04 13:18:44 UTC (rev 34640)
+++ trunk/blender/intern/ghost/intern/GHOST_WindowWin32.cpp	2011-02-04 13:22:02 UTC (rev 34641)
@@ -805,12 +805,10 @@
 	GHOST_TSuccess success;
 	switch (m_drawingContextType) {
 	case GHOST_kDrawingContextTypeOpenGL:
-		if (m_hGlRc) {
-			bool first = m_hGlRc == s_firsthGLRc;
+		// we shouldn't remove the drawing context if it's the first OpenGL context
+		// If we do, we get corrupted drawing. See #19997
+		if (m_hGlRc && m_hGlRc!=s_firsthGLRc) {
 			success = ::wglDeleteContext(m_hGlRc) == TRUE ? GHOST_kSuccess : GHOST_kFailure;
-			if (first) {
-				s_firsthGLRc = 0;
-			}
 			m_hGlRc = 0;
 		}
 		else {




More information about the Bf-blender-cvs mailing list