[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - vcl/opengl

Marco Cecchetti marco.cecchetti at collabora.com
Wed Mar 23 12:09:12 UTC 2016


 vcl/opengl/texture.cxx |   39 +++++++++++++++++++++++++--------------
 1 file changed, 25 insertions(+), 14 deletions(-)

New commits:
commit 3fcf08549baaa23c2d4c12d7a87ff24becc4fba2
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Tue Mar 22 16:22:23 2016 +0100

    trying to get a GL context after GL de-initialization - fixed
    
    Change-Id: I5f38f72b0e2c0204875d0dfbb759d6b13415560a
    Reviewed-on: https://gerrit.libreoffice.org/23433
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/vcl/opengl/texture.cxx b/vcl/opengl/texture.cxx
index 7f047e5..ffaaf09 100644
--- a/vcl/opengl/texture.cxx
+++ b/vcl/opengl/texture.cxx
@@ -161,26 +161,37 @@ void ImplOpenGLTexture::Dispose()
 {
     if( mnTexture != 0 )
     {
-        OpenGLVCLContextZone aContextZone;
+        // During shutdown GL is already de-initialized, so we should not try to create a new context.
+        OpenGLZone aZone;
+        rtl::Reference<OpenGLContext> xContext = OpenGLContext::getVCLContext(false);
+        if( xContext.is() )
+        {
+            // FIXME: this is really not optimal performance-wise.
 
-        // FIXME: this is really not optimal performance-wise.
+            // Check we have been correctly un-bound from all framebuffers.
+            ImplSVData* pSVData = ImplGetSVData();
+            rtl::Reference<OpenGLContext> pContext = pSVData->maGDIData.mpLastContext;
 
-        // Check we have been correctly un-bound from all framebuffers.
-        ImplSVData* pSVData = ImplGetSVData();
-        rtl::Reference<OpenGLContext> pContext = pSVData->maGDIData.mpLastContext;
-        if( pContext.is() )
-        {
-            pContext->makeCurrent();
-            pContext->UnbindTextureFromFramebuffers( mnTexture );
-        }
+            if( pContext.is() )
+            {
+                pContext->makeCurrent();
+                pContext->UnbindTextureFromFramebuffers( mnTexture );
+            }
 
-        if( mnOptStencil != 0 )
+            if( mnOptStencil != 0 )
+            {
+                glDeleteRenderbuffers( 1, &mnOptStencil );
+                mnOptStencil = 0;
+            }
+            glDeleteTextures( 1, &mnTexture );
+
+            mnTexture = 0;
+        }
+        else
         {
-            glDeleteRenderbuffers( 1, &mnOptStencil );
             mnOptStencil = 0;
+            mnTexture = 0;
         }
-        glDeleteTextures( 1, &mnTexture );
-        mnTexture = 0;
     }
 }
 


More information about the Libreoffice-commits mailing list