diff options
-rw-r--r-- | src/quickwidgets/qquickwidget.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp index 5d7fb04b9f..be5837723a 100644 --- a/src/quickwidgets/qquickwidget.cpp +++ b/src/quickwidgets/qquickwidget.cpp @@ -157,6 +157,16 @@ void QQuickWidgetPrivate::invalidateRenderControl() #endif renderControl->invalidate(); + + // Many things can happen inside the above invalidate() call, including a + // change of current context. Restore if needed since some code will rely + // on the fact that this function makes and leaves the context current. +#if QT_CONFIG(opengl) + if (!useSoftwareRenderer && context) { + if (QOpenGLContext::currentContext() != context) + context->makeCurrent(offscreenSurface); + } +#endif } void QQuickWidgetPrivate::handleWindowChange() |