diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-04-04 11:36:19 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-04-04 11:34:52 +0000 |
commit | 42e9a5e27c914c58dc9c734829f906fb7bb4f371 (patch) | |
tree | 8b6faee5e24516aa13b560f279d7cee7e9a446a9 /src/quickwidgets | |
parent | b4f36c22f4b883679c0dcd8a98a221cbdc987d08 (diff) |
Make QQuickWidget cleanup work with engines that alter the context
To make Scene3D in a QQuickWidget work.
Task-number: QTBUG-52132
Change-Id: I686ff36d82a1c7bdfdcd7080a314bb9afdb7be88
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/quickwidgets')
-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() |