diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2022-05-16 12:20:45 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2022-05-24 20:20:02 +0200 |
commit | ba7a3b8d4a54564d4cf5392285376b36d80f60fd (patch) | |
tree | fcc9c53b949b77a33de8d802a08983d788c7cda7 | |
parent | 34defa095a4dcb89afef51dabcbfec5a7b69e913 (diff) |
Make sure the correct context is current when invoking resizeGL
After the 6.4 changes for QRhi-based compositing in widgets there
is now a good chance that a different context is current after
recreateFbo in case it actually created a new texture and fbo.
This is not great if we immediately call resizeGL() afterwards
since the contract for the reimplementable functions is that
the QOpenGLWidget's context is current. Make sure this contract
is followed.
Fixes: QTBUG-103319
Change-Id: I59a5fa9500df34b86787927e1114d0a80297678a
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
-rw-r--r-- | src/openglwidgets/qopenglwidget.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/openglwidgets/qopenglwidget.cpp b/src/openglwidgets/qopenglwidget.cpp index d56a5e16cd..459bcdd25a 100644 --- a/src/openglwidgets/qopenglwidget.cpp +++ b/src/openglwidgets/qopenglwidget.cpp @@ -1264,6 +1264,9 @@ void QOpenGLWidget::resizeEvent(QResizeEvent *e) return; d->recreateFbo(); + // Make sure our own context is current before invoking user overrides. If + // the fbo was recreated then there's a chance something else is current now. + makeCurrent(); resizeGL(width(), height()); d->sendPaintEvent(QRect(QPoint(0, 0), size())); } |