From b5124d9719ff5609832e02cd2b555966a6646b8f Mon Sep 17 00:00:00 2001 From: Tatiana Borisova Date: Thu, 20 Jan 2022 19:29:35 +0200 Subject: Fix run time failure for UI autotests (INTEGRITY) - Add WFD resources release: It provides possibility to re-create native window on run time. It allows to run several Qt UI applications (one by one) without device reboot. - Fix crash that found during window re-creation: ~QOpenGLCompositorBacking() calls QOpenGLCompositor::instance(). But compositor is deleted for that moment. Task-number: QTBUG-99123 Pick-to: 6.2 6.3 Change-Id: I1e6dc9a012a166d1fd6cd1c24f9d2e9a8995fc00 Reviewed-by: Kimmo Ollila Reviewed-by: Janne Koskinen Reviewed-by: Laszlo Agocs --- src/opengl/qopenglcompositorbackingstore.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/opengl') diff --git a/src/opengl/qopenglcompositorbackingstore.cpp b/src/opengl/qopenglcompositorbackingstore.cpp index 40400e2a19..34542dde47 100644 --- a/src/opengl/qopenglcompositorbackingstore.cpp +++ b/src/opengl/qopenglcompositorbackingstore.cpp @@ -95,18 +95,20 @@ QOpenGLCompositorBackingStore::~QOpenGLCompositorBackingStore() QScopedPointer tempSurface; if (!ctx) { ctx = QOpenGLCompositor::instance()->context(); - tempSurface.reset(new QOffscreenSurface); - tempSurface->setFormat(ctx->format()); - tempSurface->create(); - ctx->makeCurrent(tempSurface.data()); + if (ctx) { + tempSurface.reset(new QOffscreenSurface); + tempSurface->setFormat(ctx->format()); + tempSurface->create(); + ctx->makeCurrent(tempSurface.data()); + } } - if (m_bsTextureContext && ctx->shareGroup() == m_bsTextureContext->shareGroup()) + if (m_bsTextureContext && ctx && ctx->shareGroup() == m_bsTextureContext->shareGroup()) glDeleteTextures(1, &m_bsTexture); else qWarning("QOpenGLCompositorBackingStore: Texture is not valid in the current context"); - if (tempSurface) + if (tempSurface && ctx) ctx->doneCurrent(); } -- cgit v1.2.3