summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/vcl/opengl/OpenGLContext.hxx3
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx10
2 files changed, 13 insertions, 0 deletions
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index 68d7209f6662..ce44aefa24b7 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 251be21083b4..ca53bc00c86e 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;
}