From 3ddcb3706fa3db7a302395255720b11f48883efc Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Tue, 6 Feb 2018 07:51:33 +0100 Subject: [PATCH] check for invalid contexts added --- src/nodes/QskTextureNode.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/nodes/QskTextureNode.cpp b/src/nodes/QskTextureNode.cpp index ae553935..5a7f8b31 100644 --- a/src/nodes/QskTextureNode.cpp +++ b/src/nodes/QskTextureNode.cpp @@ -177,10 +177,17 @@ QskTextureNode::~QskTextureNode() if ( d->material.textureId() > 0 ) { - GLuint id = d->material.textureId(); + /* + In certain environments we have the effect, that at + program termination the context is already gone + */ + if ( auto context = QOpenGLContext::currentContext() ) + { + GLuint id = d->material.textureId(); - auto funcs = QOpenGLContext::currentContext()->functions(); - funcs->glDeleteTextures( 1, &id ); + auto funcs = context->functions(); + funcs->glDeleteTextures( 1, &id ); + } } }