From b70745bc8b6460877346f689d128b0153a91ca6b Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Mon, 15 Apr 2024 15:16:15 +0300 Subject: [PATCH] Revert "Always destroy OpenGL context when the window is destroyed" This reverts commit 220afb358f6056a6fc091b48a38878fb98aba979. The change caused segfault after menus or dialogs were closed. The global raster compositing context is still being used by root window and cannot be deleted from child window. Fixes: QTBUG-123962 Change-Id: Ie88925052f0f424617382388c587ae47570d13a7 Reviewed-by: Laszlo Agocs (cherry picked from commit a030795bc956ce4274e3562e963d59e74f2e6fd7) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/eglfs/api/qeglfswindow.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp index 861dd9c5da6..306d121cfb7 100644 --- a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp @@ -152,15 +152,12 @@ void QEglFSWindow::destroy() #ifndef QT_NO_OPENGL QOpenGLCompositor::destroy(); + if (qt_gl_global_share_context() == m_rasterCompositingContext) + qt_gl_set_global_share_context(nullptr); + delete m_rasterCompositingContext; #endif } -#ifndef QT_NO_OPENGL - if (qt_gl_global_share_context() == m_rasterCompositingContext) - qt_gl_set_global_share_context(nullptr); - delete m_rasterCompositingContext; -#endif - m_flags = { }; }