Fix one more crash on context loss.

This commit is contained in:
John Preston 2021-09-23 17:37:03 +04:00
parent d81997194e
commit 29cfdad44c

View file

@ -91,6 +91,9 @@ void SurfaceOpenGL::paintEvent(QPaintEvent *e) {
return; return;
} }
engine->begin(device); engine->begin(device);
if (!isValid()) { // The call above could lose the context.
return;
}
const auto f = context()->functions(); const auto f = context()->functions();
if (const auto bg = _renderer->clearColor()) { if (const auto bg = _renderer->clearColor()) {
f->glClearColor(bg->redF(), bg->greenF(), bg->blueF(), bg->alphaF()); f->glClearColor(bg->redF(), bg->greenF(), bg->blueF(), bg->alphaF());