From 41d37407e80f5ccd110cf303c20a181f95fa7e73 Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Fri, 21 Jan 2022 16:01:35 +0100 Subject: Make singleton teardown work with Qt6 as well In Qt6 the Q_GLOBAL_STATIC will already report to be null while it is in the process of being deleted, we therefore cannot access it anymore from destruction code path as we did before. This problem is hit for example by the Breeze style, making all 6 based widgets applications crash on exit without this. --- autotests/kconfig_compiler/test_signal.cpp.ref | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'autotests/kconfig_compiler/test_signal.cpp.ref') diff --git a/autotests/kconfig_compiler/test_signal.cpp.ref b/autotests/kconfig_compiler/test_signal.cpp.ref index 71ab7a09..378cd2c2 100644 --- a/autotests/kconfig_compiler/test_signal.cpp.ref +++ b/autotests/kconfig_compiler/test_signal.cpp.ref @@ -10,7 +10,7 @@ class TestSignalHelper { public: TestSignalHelper() : q(nullptr) {} - ~TestSignalHelper() { delete q; } + ~TestSignalHelper() { delete q; q = nullptr; } TestSignalHelper(const TestSignalHelper&) = delete; TestSignalHelper& operator=(const TestSignalHelper&) = delete; TestSignal *q; @@ -63,7 +63,9 @@ TestSignal::TestSignal( ) TestSignal::~TestSignal() { - s_globalTestSignal()->q = nullptr; + if (s_globalTestSignal.exists() && !s_globalTestSignal.isDestroyed()) { + s_globalTestSignal()->q = nullptr; + } } bool TestSignal::usrSave() -- cgit v1.2.1