check for invalid contexts added

This commit is contained in:
Uwe Rathmann 2018-02-06 07:51:33 +01:00
parent 84d8c87309
commit 3ddcb3706f

View File

@ -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 );
}
}
}