From 29cfdad44c22cb653fe756e4e1fba0f172fb3ca7 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 23 Sep 2021 17:37:03 +0400 Subject: [PATCH] Fix one more crash on context loss. --- ui/gl/gl_surface.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/gl/gl_surface.cpp b/ui/gl/gl_surface.cpp index a08ffe6..ba58ac2 100644 --- a/ui/gl/gl_surface.cpp +++ b/ui/gl/gl_surface.cpp @@ -91,6 +91,9 @@ void SurfaceOpenGL::paintEvent(QPaintEvent *e) { return; } engine->begin(device); + if (!isValid()) { // The call above could lose the context. + return; + } const auto f = context()->functions(); if (const auto bg = _renderer->clearColor()) { f->glClearColor(bg->redF(), bg->greenF(), bg->blueF(), bg->alphaF());