From 06a558e3de658f300b295beac7c4adc4f08227f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Fl=C3=B6ser?= Date: Sun, 16 Jul 2017 17:58:25 +0200 Subject: [PATCH] [platforms/x11] Quit the OpenGL Freeze protection thread on shutdown Summary: Weird NVIDIA behavior fixup part 2. Now that we do no longer freeze when NVIDIA decides to create an OpenGL error on startup (aefb5f4dd9d41aa7377d56ece203089c73aefe07), we experience a new issue. KWin is terminating (no idea why, [1]) and at the same time the OpenGL freeze protection thread is still running. So far we did not terminate the thread on shutdown and thus we hit an abort in Qt. This change ensures that we properly terminate the thread on shutdown. [1] My current theory is that games terminate KWin, common pattern of bug reports is "steam". BUG: 382283 FIXED-IN: 5.10.4 Test Plan: Tortured KWin by making sure I go through the code path, saw the abort without the patch, no more abort with the patch Reviewers: #kwin, #plasma Subscribers: plasma-devel, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D6735 --- plugins/platforms/x11/standalone/x11_platform.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/platforms/x11/standalone/x11_platform.cpp b/plugins/platforms/x11/standalone/x11_platform.cpp index 5fdb3a34de..064daf5855 100644 --- a/plugins/platforms/x11/standalone/x11_platform.cpp +++ b/plugins/platforms/x11/standalone/x11_platform.cpp @@ -63,7 +63,14 @@ X11StandalonePlatform::X11StandalonePlatform(QObject *parent) #endif } -X11StandalonePlatform::~X11StandalonePlatform() = default; +X11StandalonePlatform::~X11StandalonePlatform() +{ + if (m_openGLFreezeProtectionThread) { + m_openGLFreezeProtectionThread->quit(); + m_openGLFreezeProtectionThread->wait(); + delete m_openGLFreezeProtectionThread; + } +} void X11StandalonePlatform::init() {