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);