[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - include/vcl vcl/source

Michael Stahl mstahl at redhat.com
Thu Oct 1 01:37:42 PDT 2015


 include/vcl/opengl/OpenGLContext.hxx |    3 +++
 vcl/source/opengl/OpenGLContext.cxx  |   10 ++++++++++
 2 files changed, 13 insertions(+)

New commits:
commit 418d7171e1a1ad669c2d8ecfa75ae688a0bf9d70
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Sep 30 18:25:45 2015 +0200

    vcl: clean up before error returns in OpenGLContext::ImplInit()
    
    JunitTest_chart_unoapi fails here with "assert(!hasCurrent())" because
    the initialization apparently fails due to lack of a
    wglCreateContextAttribsARB in the VM, so ensure that the hTempRC is not
    active and also deleted in all cases.
    
    (cherry picked from commit 5efad73918152f380fa1bf1e2cd3bc06b6353683)
    
    vcl: even in the newfangled OpenGL world, initializing members is ...
    ... still a good idea.
    (cherry picked from commit 37d243651b7db5dc313686f474f4e7c92e2160ce)
    
    Change-Id: I7e03b95d1146af48a24e34692c3c2827298fccee
    Reviewed-on: https://gerrit.libreoffice.org/19040
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index 68d7209..ce44aef 100644
--- a/include/vcl/opengl/OpenGLContext.hxx
+++ b/include/vcl/opengl/OpenGLContext.hxx
@@ -142,6 +142,9 @@ struct GLWindow
     GLWindow()
         :
 #if defined( _WIN32 )
+        hWnd(NULL),
+        hDC(NULL),
+        hRC(NULL),
 #elif defined( MACOSX )
 #elif defined( IOS )
 #elif defined( ANDROID )
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 251be21..ca53bc0 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -960,14 +960,22 @@ bool OpenGLContext::ImplInit()
     }
 
     if (!InitGLEW())
+    {
+        wglMakeCurrent(NULL, NULL);
+        wglDeleteContext(hTempRC);
         return false;
+    }
 
     HGLRC hSharedCtx = 0;
     if (!g_vShareList.empty())
         hSharedCtx = g_vShareList.front();
 
     if (!wglCreateContextAttribsARB)
+    {
+        wglMakeCurrent(NULL, NULL);
+        wglDeleteContext(hTempRC);
         return false;
+    }
 
     // now setup the shared context; this needs a temporary context already
     // set up in order to work
@@ -983,6 +991,8 @@ bool OpenGLContext::ImplInit()
     {
         ImplWriteLastError(GetLastError(), "wglCreateContextAttribsARB in OpenGLContext::ImplInit");
         SAL_WARN("vcl.opengl", "wglCreateContextAttribsARB failed");
+        wglMakeCurrent(NULL, NULL);
+        wglDeleteContext(hTempRC);
         return false;
     }
 


More information about the Libreoffice-commits mailing list