diff options
author | Volker Krause <vkrause@kde.org> | 2022-01-21 16:01:35 +0100 |
---|---|---|
committer | Volker Krause <vkrause@kde.org> | 2022-01-22 12:35:06 +0100 |
commit | 41d37407e80f5ccd110cf303c20a181f95fa7e73 (patch) | |
tree | bc343cd6335934f9be8be7855d9398c32b35bcd3 /autotests | |
parent | 3bbe9de5d59a6572f3549cc3a553dd44db421b68 (diff) | |
download | kconfig-41d37407e80f5ccd110cf303c20a181f95fa7e73.tar.gz kconfig-41d37407e80f5ccd110cf303c20a181f95fa7e73.tar.bz2 |
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.
Diffstat (limited to 'autotests')
-rw-r--r-- | autotests/kconfig_compiler/test10.cpp.ref | 6 | ||||
-rw-r--r-- | autotests/kconfig_compiler/test4.cpp.ref | 6 | ||||
-rw-r--r-- | autotests/kconfig_compiler/test5.cpp.ref | 6 | ||||
-rw-r--r-- | autotests/kconfig_compiler/test8b.cpp.ref | 6 | ||||
-rw-r--r-- | autotests/kconfig_compiler/test8c.cpp.ref | 6 | ||||
-rw-r--r-- | autotests/kconfig_compiler/test_dpointer.cpp.ref | 6 | ||||
-rw-r--r-- | autotests/kconfig_compiler/test_emptyentries.cpp.ref | 6 | ||||
-rw-r--r-- | autotests/kconfig_compiler/test_signal.cpp.ref | 6 |
8 files changed, 32 insertions, 16 deletions
diff --git a/autotests/kconfig_compiler/test10.cpp.ref b/autotests/kconfig_compiler/test10.cpp.ref index 94d9f311..2369d2c3 100644 --- a/autotests/kconfig_compiler/test10.cpp.ref +++ b/autotests/kconfig_compiler/test10.cpp.ref @@ -10,7 +10,7 @@ class Test10Helper { public: Test10Helper() : q(nullptr) {} - ~Test10Helper() { delete q; } + ~Test10Helper() { delete q; q = nullptr; } Test10Helper(const Test10Helper&) = delete; Test10Helper& operator=(const Test10Helper&) = delete; Test10 *q; @@ -43,6 +43,8 @@ Test10::Test10( ) Test10::~Test10() { - s_globalTest10()->q = nullptr; + if (s_globalTest10.exists() && !s_globalTest10.isDestroyed()) { + s_globalTest10()->q = nullptr; + } } diff --git a/autotests/kconfig_compiler/test4.cpp.ref b/autotests/kconfig_compiler/test4.cpp.ref index fb4db2ff..2e7ad7d7 100644 --- a/autotests/kconfig_compiler/test4.cpp.ref +++ b/autotests/kconfig_compiler/test4.cpp.ref @@ -10,7 +10,7 @@ class Test4Helper { public: Test4Helper() : q(nullptr) {} - ~Test4Helper() { delete q; } + ~Test4Helper() { delete q; q = nullptr; } Test4Helper(const Test4Helper&) = delete; Test4Helper& operator=(const Test4Helper&) = delete; Test4 *q; @@ -178,6 +178,8 @@ QColor defaultColor[4] = { Qt::red, Qt::blue, Qt::green, Qt::black }; Test4::~Test4() { - s_globalTest4()->q = nullptr; + if (s_globalTest4.exists() && !s_globalTest4.isDestroyed()) { + s_globalTest4()->q = nullptr; + } } diff --git a/autotests/kconfig_compiler/test5.cpp.ref b/autotests/kconfig_compiler/test5.cpp.ref index 2b50222c..1272b446 100644 --- a/autotests/kconfig_compiler/test5.cpp.ref +++ b/autotests/kconfig_compiler/test5.cpp.ref @@ -10,7 +10,7 @@ class Test5Helper { public: Test5Helper() : q(nullptr) {} - ~Test5Helper() { delete q; } + ~Test5Helper() { delete q; q = nullptr; } Test5Helper(const Test5Helper&) = delete; Test5Helper& operator=(const Test5Helper&) = delete; Test5 *q; @@ -89,6 +89,8 @@ QColor defaultColor[4] = { Qt::red, Qt::blue, Qt::green, Qt::black }; Test5::~Test5() { - s_globalTest5()->q = nullptr; + if (s_globalTest5.exists() && !s_globalTest5.isDestroyed()) { + s_globalTest5()->q = nullptr; + } } diff --git a/autotests/kconfig_compiler/test8b.cpp.ref b/autotests/kconfig_compiler/test8b.cpp.ref index d2ee566b..9c81fdbd 100644 --- a/autotests/kconfig_compiler/test8b.cpp.ref +++ b/autotests/kconfig_compiler/test8b.cpp.ref @@ -10,7 +10,7 @@ class Test8bHelper { public: Test8bHelper() : q(nullptr) {} - ~Test8bHelper() { delete q; } + ~Test8bHelper() { delete q; q = nullptr; } Test8bHelper(const Test8bHelper&) = delete; Test8bHelper& operator=(const Test8bHelper&) = delete; Test8b *q; @@ -49,6 +49,8 @@ Test8b::Test8b( ) Test8b::~Test8b() { - s_globalTest8b()->q = nullptr; + if (s_globalTest8b.exists() && !s_globalTest8b.isDestroyed()) { + s_globalTest8b()->q = nullptr; + } } diff --git a/autotests/kconfig_compiler/test8c.cpp.ref b/autotests/kconfig_compiler/test8c.cpp.ref index d806ca79..a0878b86 100644 --- a/autotests/kconfig_compiler/test8c.cpp.ref +++ b/autotests/kconfig_compiler/test8c.cpp.ref @@ -12,7 +12,7 @@ class Test8cHelper { public: Test8cHelper() : q(nullptr) {} - ~Test8cHelper() { delete q; } + ~Test8cHelper() { delete q; q = nullptr; } Test8cHelper(const Test8cHelper&) = delete; Test8cHelper& operator=(const Test8cHelper&) = delete; Test8c *q; @@ -63,6 +63,8 @@ Test8c::Test8c( KSharedConfig::Ptr config, QObject *parent ) Test8c::~Test8c() { - s_globalTest8c()->q = nullptr; + if (s_globalTest8c.exists() && !s_globalTest8c.isDestroyed()) { + s_globalTest8c()->q = nullptr; + } } diff --git a/autotests/kconfig_compiler/test_dpointer.cpp.ref b/autotests/kconfig_compiler/test_dpointer.cpp.ref index 14af30b7..de533005 100644 --- a/autotests/kconfig_compiler/test_dpointer.cpp.ref +++ b/autotests/kconfig_compiler/test_dpointer.cpp.ref @@ -49,7 +49,7 @@ class TestDPointerHelper { public: TestDPointerHelper() : q(nullptr) {} - ~TestDPointerHelper() { delete q; } + ~TestDPointerHelper() { delete q; q = nullptr; } TestDPointerHelper(const TestDPointerHelper&) = delete; TestDPointerHelper& operator=(const TestDPointerHelper&) = delete; TestDPointer *q; @@ -414,6 +414,8 @@ KConfigSkeleton::ItemFont *TestDPointer::timeBarFontItem() TestDPointer::~TestDPointer() { delete d; - s_globalTestDPointer()->q = nullptr; + if (s_globalTestDPointer.exists() && !s_globalTestDPointer.isDestroyed()) { + s_globalTestDPointer()->q = nullptr; + } } diff --git a/autotests/kconfig_compiler/test_emptyentries.cpp.ref b/autotests/kconfig_compiler/test_emptyentries.cpp.ref index e23ddc3c..3634ba6c 100644 --- a/autotests/kconfig_compiler/test_emptyentries.cpp.ref +++ b/autotests/kconfig_compiler/test_emptyentries.cpp.ref @@ -12,7 +12,7 @@ class QMakeBuilderSettingsHelper { public: QMakeBuilderSettingsHelper() : q(nullptr) {} - ~QMakeBuilderSettingsHelper() { delete q; } + ~QMakeBuilderSettingsHelper() { delete q; q = nullptr; } QMakeBuilderSettingsHelper(const QMakeBuilderSettingsHelper&) = delete; QMakeBuilderSettingsHelper& operator=(const QMakeBuilderSettingsHelper&) = delete; QMakeBuilderSettings *q; @@ -54,6 +54,8 @@ QMakeBuilderSettings::QMakeBuilderSettings( KSharedConfig::Ptr config ) QMakeBuilderSettings::~QMakeBuilderSettings() { - s_globalQMakeBuilderSettings()->q = nullptr; + if (s_globalQMakeBuilderSettings.exists() && !s_globalQMakeBuilderSettings.isDestroyed()) { + s_globalQMakeBuilderSettings()->q = nullptr; + } } 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() |