vcl/source/opengl/OpenGLContext.cxx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
New commits: commit 2e9816e59f7f44356b5bdc8d0e7da21cdd497f9a Author: Markus Mohrhard <[email protected]> Date: Thu Dec 4 08:18:46 2014 +0100 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 diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index d7a2798..56e565f 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 ) commit e167148c3f3e3a76335e6920ae31b0282be23e8c Author: Markus Mohrhard <[email protected]> Date: Thu Dec 4 08:08:50 2014 +0100 more asserts to detect double deletes Change-Id: I54284d34db2446f28ba778ce26ebedb584bf2780 diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index 0ebca34..d7a2798 100644 --- a/vcl/source/opengl/OpenGLContext.cxx +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -128,11 +128,13 @@ OpenGLContext::~OpenGLContext() void OpenGLContext::AddRef() { + assert(mnRefCount > 0); mnRefCount++; } void OpenGLContext::DeRef() { + assert(mnRefCount > 0); if( --mnRefCount == 0 ) delete this; } commit f5425301052357499a41d798c43c9f2c3306db4d Author: Markus Mohrhard <[email protected]> Date: Thu Dec 4 08:05:33 2014 +0100 add assert to detect double delete Conflicts: vcl/source/opengl/OpenGLContext.cxx Change-Id: I13427cb698d29adb1d19b135ada91bcdfc8b8c92 diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index c9c3ecb..0ebca34 100644 --- a/vcl/source/opengl/OpenGLContext.cxx +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -96,7 +96,9 @@ OpenGLContext::~OpenGLContext() #if defined( WNT ) if (m_aGLWin.hRC) { - g_vShareList.erase(std::remove(g_vShareList.begin(), g_vShareList.end(), m_aGLWin.hRC), g_vShareList.end()); + 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); wglMakeCurrent( m_aGLWin.hDC, 0 ); wglDeleteContext( m_aGLWin.hRC ); commit 64e45440ad11c1aabeaf853607bcb7e5f4fbafe4 Author: Markus Mohrhard <[email protected]> Date: Thu Dec 4 07:19:09 2014 +0100 add more debugging output Change-Id: I91be83485dcd829800ca9611ab54b19d8eae19af diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index 50a95da..c9c3ecb 100644 --- a/vcl/source/opengl/OpenGLContext.cxx +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -65,6 +65,7 @@ OpenGLContext::OpenGLContext(): mpPrevContext(NULL), mpNextContext(NULL) { + SAL_INFO("vcl.opengl", "new context: " << this); #if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID mbPixmap = false; #endif @@ -82,6 +83,7 @@ OpenGLContext::OpenGLContext(): OpenGLContext::~OpenGLContext() { + SAL_INFO("vcl.opengl", "delete context: " << this); ImplSVData* pSVData = ImplGetSVData(); if( mpPrevContext ) mpPrevContext->mpNextContext = mpNextContext; _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
