From ef5ef903fe2c2b9c3caab1da6107466e12fa731f Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Mon, 27 Jan 2020 23:00:49 -0800 Subject: [PATCH] Qt: Fix crash unloading shaders --- CHANGES | 1 + src/platform/qt/DisplayGL.cpp | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGES b/CHANGES index 9635589cd..36f354ba7 100644 --- a/CHANGES +++ b/CHANGES @@ -9,6 +9,7 @@ Other fixes: - Qt: Fix race condition with proxied video events - Qt: Fix color selection in asset view (fixes mgba.io/i/1648) - Qt: Fix missing OSD messages + - Qt: Fix crash unloading shaders 0.8.0: (2020-01-21) Features: diff --git a/src/platform/qt/DisplayGL.cpp b/src/platform/qt/DisplayGL.cpp index 3cb5bb8c9..c4ee598be 100644 --- a/src/platform/qt/DisplayGL.cpp +++ b/src/platform/qt/DisplayGL.cpp @@ -566,10 +566,19 @@ void PainterGL::clearShaders() { return; } #ifdef BUILD_GLES2 + if (!m_started) { + m_gl->makeCurrent(m_surface); +#if defined(_WIN32) && defined(USE_EPOXY) + epoxy_handle_external_wglMakeCurrent(); +#endif + } if (m_shader.passes) { mGLES2ShaderDetach(reinterpret_cast(m_backend)); mGLES2ShaderFree(&m_shader); } + if (!m_started) { + m_gl->doneCurrent(); + } #endif }