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 <allan.jensen@qt.io>
bb10
Laszlo Agocs 2019-03-11 14:27:04 +01:00
parent 1029a2e010
commit 1d1dcd8d6c
1 changed files with 2 additions and 1 deletions

View File

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