From ba7a3b8d4a54564d4cf5392285376b36d80f60fd Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 16 May 2022 12:20:45 +0200 Subject: Make sure the correct context is current when invoking resizeGL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Andy Nichols --- src/openglwidgets/qopenglwidget.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') 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())); } -- cgit v1.2.3