From 1d1dcd8d6c64a35b94b351f72cc447771834df49 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 11 Mar 2019 14:27:04 +0100 Subject: Fix context loss in QOpenGLWidget upon tlw change with AA_ShareOpenGLContexts The logic introduced in 2ea90c56 has an issue: it resets (destroy the context and co.) upong TLW change even when AA_ShareOpenGLContexts is set, and that is just wrong and goes against what the docs claim. Fixes: QTBUG-74307 Change-Id: Ib519045c1d9842664cbe602d4e6425660cf638b5 Reviewed-by: Allan Sandfeld Jensen --- src/widgets/kernel/qopenglwidget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp index 89f860150f..7aef74c507 100644 --- a/src/widgets/kernel/qopenglwidget.cpp +++ b/src/widgets/kernel/qopenglwidget.cpp @@ -1448,7 +1448,8 @@ bool QOpenGLWidget::event(QEvent *e) { // Special case: did grabFramebuffer() for a hidden widget that then became visible. // Recreate all resources since the context now needs to share with the TLW's. - d->reset(); + if (!qGuiApp->testAttribute(Qt::AA_ShareOpenGLContexts)) + d->reset(); } if (!d->initialized && !size().isEmpty() && window()->windowHandle()) { d->initialize(); -- cgit v1.2.3