summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-12-04 08:18:46 +0100
committerMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-12-04 08:28:42 +0100
commit2e9816e59f7f44356b5bdc8d0e7da21cdd497f9a (patch)
treec0af1a720f2a4259e8be2ae1c5b6d5df2b78ab4a /vcl
parente167148c3f3e3a76335e6920ae31b0282be23e8c (diff)
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
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index d7a27981891f..56e565f4c023 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -96,9 +96,9 @@ OpenGLContext::~OpenGLContext()
#if defined( WNT )
if (m_aGLWin.hRC)
{
- std::vector<HGLRC>::const_iterator itr = std::remove(g_vShareList.begin(), g_vShareList.end(), m_aGLWin.hRC);
- assert(itr != g_vShareList.end());
- g_vShareList.erase(itr);
+ std::vector<HGLRC>::iterator itr = std::remove(g_vShareList.begin(), g_vShareList.end(), m_aGLWin.hRC);
+ if (itr != g_vShareList.end())
+ g_vShareList.erase(itr);
wglMakeCurrent( m_aGLWin.hDC, 0 );
wglDeleteContext( m_aGLWin.hRC );
@@ -111,7 +111,9 @@ OpenGLContext::~OpenGLContext()
#elif defined( UNX )
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);
if( glGetError() != GL_NO_ERROR )