Kaydet (Commit) 418d7171 authored tarafından Michael Stahl's avatar Michael Stahl Kaydeden (comit) Markus Mohrhard

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 5efad739)

vcl: even in the newfangled OpenGL world, initializing members is ...
... still a good idea.
(cherry picked from commit 37d24365)

Change-Id: I7e03b95d1146af48a24e34692c3c2827298fccee
Reviewed-on: https://gerrit.libreoffice.org/19040Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst 82f88758
...@@ -142,6 +142,9 @@ struct GLWindow ...@@ -142,6 +142,9 @@ struct GLWindow
GLWindow() GLWindow()
: :
#if defined( _WIN32 ) #if defined( _WIN32 )
hWnd(NULL),
hDC(NULL),
hRC(NULL),
#elif defined( MACOSX ) #elif defined( MACOSX )
#elif defined( IOS ) #elif defined( IOS )
#elif defined( ANDROID ) #elif defined( ANDROID )
......
...@@ -960,14 +960,22 @@ bool OpenGLContext::ImplInit() ...@@ -960,14 +960,22 @@ bool OpenGLContext::ImplInit()
} }
if (!InitGLEW()) if (!InitGLEW())
{
wglMakeCurrent(NULL, NULL);
wglDeleteContext(hTempRC);
return false; return false;
}
HGLRC hSharedCtx = 0; HGLRC hSharedCtx = 0;
if (!g_vShareList.empty()) if (!g_vShareList.empty())
hSharedCtx = g_vShareList.front(); hSharedCtx = g_vShareList.front();
if (!wglCreateContextAttribsARB) if (!wglCreateContextAttribsARB)
{
wglMakeCurrent(NULL, NULL);
wglDeleteContext(hTempRC);
return false; return false;
}
// now setup the shared context; this needs a temporary context already // now setup the shared context; this needs a temporary context already
// set up in order to work // set up in order to work
...@@ -983,6 +991,8 @@ bool OpenGLContext::ImplInit() ...@@ -983,6 +991,8 @@ bool OpenGLContext::ImplInit()
{ {
ImplWriteLastError(GetLastError(), "wglCreateContextAttribsARB in OpenGLContext::ImplInit"); ImplWriteLastError(GetLastError(), "wglCreateContextAttribsARB in OpenGLContext::ImplInit");
SAL_WARN("vcl.opengl", "wglCreateContextAttribsARB failed"); SAL_WARN("vcl.opengl", "wglCreateContextAttribsARB failed");
wglMakeCurrent(NULL, NULL);
wglDeleteContext(hTempRC);
return false; return false;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment