diff options
author | David Edmundson <davidedmundson@kde.org> | 2019-08-29 09:27:45 +0100 |
---|---|---|
committer | David Edmundson <davidedmundson@kde.org> | 2019-10-08 22:26:20 +0100 |
commit | 97c488a3740492d804ffce6ad948f19bd21b7544 (patch) | |
tree | ab46511f5737e3e8e652ee11154fc4df7c4e8e1c /src | |
parent | adc268574ccfd602bd5fccba6bea00f3f8a58e26 (diff) |
Handle context loss in QQuickWidget
QQuickWidget handles its own rendering, and so needs the same code as
the two render loops
Change-Id: I6549048dd77a44a52d79a7aa6fe7eceee4dbdc9a
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/quickwidgets/qquickwidget.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp index 0da9b12e86..c975404d69 100644 --- a/src/quickwidgets/qquickwidget.cpp +++ b/src/quickwidgets/qquickwidget.cpp @@ -283,7 +283,16 @@ void QQuickWidgetPrivate::render(bool needsSync) Q_ASSERT(context); - if (!context->makeCurrent(offscreenSurface)) { + bool current = context->makeCurrent(offscreenSurface); + + if (!current && !context->isValid()) { + renderControl->invalidate(); + current = context->create() && context->makeCurrent(offscreenSurface); + if (current) + renderControl->initialize(context); + } + + if (!current) { qWarning("QQuickWidget: Cannot render due to failing makeCurrent()"); return; } |