From ff4cfe279ac9ed2fbf262151661101db3258d888 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 22 Feb 2024 17:10:49 +0200 Subject: [PATCH] backends/x11: Avoid calling doneCurrent() if GLX context has not been created BUG: 477854 --- .../x11/standalone/x11_standalone_glx_backend.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/backends/x11/standalone/x11_standalone_glx_backend.cpp b/src/backends/x11/standalone/x11_standalone_glx_backend.cpp index 2371c90622..ce2c2935d8 100644 --- a/src/backends/x11/standalone/x11_standalone_glx_backend.cpp +++ b/src/backends/x11/standalone/x11_standalone_glx_backend.cpp @@ -154,12 +154,15 @@ GlxBackend::~GlxBackend() if (isFailed()) { m_overlayWindow->destroy(); } - // TODO: cleanup in error case - // do cleanup after initBuffer() - cleanupGL(); - doneCurrent(); - m_context.reset(); + if (m_context) { + // TODO: cleanup in error case + // do cleanup after initBuffer() + cleanupGL(); + doneCurrent(); + + m_context.reset(); + } if (glxWindow) { glXDestroyWindow(display(), glxWindow);