diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp index 70ab9825e9e75dd1c21182875512f0660f7fd71b..22f5662c348f5371d1fd5a7efdf8b566dfb7cce3 100644 --- a/src/gui/painting/qplatformbackingstore.cpp +++ b/src/gui/painting/qplatformbackingstore.cpp @@ -66,11 +66,14 @@ public: { #ifndef QT_NO_OPENGL QOpenGLContext *ctx = QOpenGLContext::currentContext(); - Q_ASSERT(ctx); - if (textureId) - ctx->functions()->glDeleteTextures(1, &textureId); - if (blitter) - blitter->destroy(); + if (ctx) { + if (textureId) + ctx->functions()->glDeleteTextures(1, &textureId); + if (blitter) + blitter->destroy(); + } else if (textureId || blitter) { + qWarning("No context current during QPlatformBackingStore destruction, OpenGL resources not released"); + } delete blitter; #endif }