aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickwidgets/qquickwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quickwidgets/qquickwidget.cpp')
-rw-r--r--src/quickwidgets/qquickwidget.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp
index 6709d88fa3..7f869c6ba5 100644
--- a/src/quickwidgets/qquickwidget.cpp
+++ b/src/quickwidgets/qquickwidget.cpp
@@ -778,9 +778,10 @@ void QQuickWidget::createFramebufferObject()
return;
}
- if (context->shareContext() != QWidgetPrivate::get(window())->shareContext()) {
- context->setShareContext(QWidgetPrivate::get(window())->shareContext());
- context->setScreen(context->shareContext()->screen());
+ QOpenGLContext *shareWindowContext = QWidgetPrivate::get(window())->shareContext();
+ if (shareWindowContext && context->shareContext() != shareWindowContext) {
+ context->setShareContext(shareWindowContext);
+ context->setScreen(shareWindowContext->screen());
if (!context->create())
qWarning("QQuickWidget: Failed to recreate context");
// The screen may be different so we must recreate the offscreen surface too.