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>
This commit is contained in:
David Edmundson 2019-08-29 09:36:53 +01:00
parent c962c77044
commit 3425c9c6d7

View File

@ -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;
}