summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorDavid Edmundson <davidedmundson@kde.org>2019-08-29 09:36:53 +0100
committerDavid Edmundson <davidedmundson@kde.org>2019-10-08 18:11:12 +0100
commit3425c9c6d7f7915e6f7931da46105b36245e86ad (patch)
tree7c328313c6714f99e583d602ff866a6b370f877c /src/gui
parentc962c77044901a08d1ec15ffec81d48f87a35b4a (diff)
Handle context loss in QPlatformBackingStore
This powers a QQuickWidget and we also need to reset the context if we get a context loss event. Change-Id: Id8b7112606670985860069c2bb11cf141b3ac723 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/painting/qplatformbackingstore.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp
index 601dc97be1..45e90bd99b 100644
--- a/src/gui/painting/qplatformbackingstore.cpp
+++ b/src/gui/painting/qplatformbackingstore.cpp
@@ -338,7 +338,16 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion &regi
}
}
- if (!d_ptr->context->makeCurrent(window)) {
+ bool current = d_ptr->context->makeCurrent(window);
+
+ if (!current && !d_ptr->context->isValid()) {
+ delete d_ptr->blitter;
+ d_ptr->blitter = nullptr;
+ d_ptr->textureId = 0;
+ current = d_ptr->context->create() && d_ptr->context->makeCurrent(window);
+ }
+
+ if (!current) {
qCWarning(lcQpaBackingStore, "composeAndFlush: makeCurrent() failed");
return;
}