diff options
author | David Edmundson <davidedmundson@kde.org> | 2019-08-29 09:36:53 +0100 |
---|---|---|
committer | David Edmundson <davidedmundson@kde.org> | 2019-10-08 18:11:12 +0100 |
commit | 3425c9c6d7f7915e6f7931da46105b36245e86ad (patch) | |
tree | 7c328313c6714f99e583d602ff866a6b370f877c /src/gui | |
parent | c962c77044901a08d1ec15ffec81d48f87a35b4a (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.cpp | 11 |
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 ®i } } - 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; } |