summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2016-03-22 16:22:23 +0100
committerMichael Meeks <michael.meeks@collabora.com>2016-03-23 11:10:28 +0000
commit2355067fa131c136555cb290c4e9d5042e005184 (patch)
treed17582f0a4fdd70b05a5a838b796e4df4bdc5223 /vcl
parent46271755841ade4445bad1b2a02d4c3b083025d4 (diff)
trying to get a GL context after GL de-initialization - fixed
Change-Id: I5f38f72b0e2c0204875d0dfbb759d6b13415560a Reviewed-on: https://gerrit.libreoffice.org/23434 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/opengl/texture.cxx39
1 files changed, 25 insertions, 14 deletions
diff --git a/vcl/opengl/texture.cxx b/vcl/opengl/texture.cxx
index 3b484c00e6e2..1b2e5a7caec6 100644
--- a/vcl/opengl/texture.cxx
+++ b/vcl/opengl/texture.cxx
@@ -164,26 +164,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;
}
}