Kaydet (Commit) 2e9816e5 authored tarafından Markus Mohrhard's avatar Markus Mohrhard Kaydeden (comit) Markus Mohrhard

prevent crash when creating the platform context failed

It is not a double delete. It happens when creating the platform context
fails and therefore is not added to the list.

Conflicts:
	vcl/source/opengl/OpenGLContext.cxx

Change-Id: I2771da48a5d791bbf500b56d8734dd53b32f3fb7
üst e167148c
...@@ -96,9 +96,9 @@ OpenGLContext::~OpenGLContext() ...@@ -96,9 +96,9 @@ OpenGLContext::~OpenGLContext()
#if defined( WNT ) #if defined( WNT )
if (m_aGLWin.hRC) if (m_aGLWin.hRC)
{ {
std::vector<HGLRC>::const_iterator itr = std::remove(g_vShareList.begin(), g_vShareList.end(), m_aGLWin.hRC); std::vector<HGLRC>::iterator itr = std::remove(g_vShareList.begin(), g_vShareList.end(), m_aGLWin.hRC);
assert(itr != g_vShareList.end()); if (itr != g_vShareList.end())
g_vShareList.erase(itr); g_vShareList.erase(itr);
wglMakeCurrent( m_aGLWin.hDC, 0 ); wglMakeCurrent( m_aGLWin.hDC, 0 );
wglDeleteContext( m_aGLWin.hRC ); wglDeleteContext( m_aGLWin.hRC );
...@@ -111,7 +111,9 @@ OpenGLContext::~OpenGLContext() ...@@ -111,7 +111,9 @@ OpenGLContext::~OpenGLContext()
#elif defined( UNX ) #elif defined( UNX )
if(m_aGLWin.ctx) if(m_aGLWin.ctx)
{ {
g_vShareList.erase(std::remove( g_vShareList.begin(), g_vShareList.end(), m_aGLWin.ctx), g_vShareList.end()); std::vector<GLXContext>::iterator itr = std::remove( g_vShareList.begin(), g_vShareList.end(), m_aGLWin.ctx );
if (itr != g_vShareList.end())
g_vShareList.erase(itr);
glXMakeCurrent(m_aGLWin.dpy, None, NULL); glXMakeCurrent(m_aGLWin.dpy, None, NULL);
if( glGetError() != GL_NO_ERROR ) if( glGetError() != GL_NO_ERROR )
......
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