From 0bad5469fc82e938ca8aaf5510a6cb4de463bd39 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sun, 1 Nov 2020 17:59:41 +0100 Subject: [PATCH] [libcalamares] Fix tests failures from JobQueue asserts Some compile flags changed recently, triggering assert() in the jobqueue when there is more than one. There's no real reason for JobQueue to be a singleton, but it wants to be. So clean up pointers a little more enthusiastically. --- src/libcalamares/JobQueue.cpp | 1 + src/modules/partition/tests/CreateLayoutsTests.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libcalamares/JobQueue.cpp b/src/libcalamares/JobQueue.cpp index 1637f0719..b66be7ebe 100644 --- a/src/libcalamares/JobQueue.cpp +++ b/src/libcalamares/JobQueue.cpp @@ -249,6 +249,7 @@ JobQueue::~JobQueue() } delete m_storage; + s_instance = nullptr; } diff --git a/src/modules/partition/tests/CreateLayoutsTests.cpp b/src/modules/partition/tests/CreateLayoutsTests.cpp index fb991fc82..4b76bb83a 100644 --- a/src/modules/partition/tests/CreateLayoutsTests.cpp +++ b/src/modules/partition/tests/CreateLayoutsTests.cpp @@ -25,6 +25,7 @@ class SmartStatus; QTEST_GUILESS_MAIN( CreateLayoutsTests ) static CalamaresUtils::Partition::KPMManager* kpmcore = nullptr; +static Calamares::JobQueue* jobqueue = nullptr; using CalamaresUtils::operator""_MiB; using CalamaresUtils::operator""_GiB; @@ -39,7 +40,7 @@ CreateLayoutsTests::CreateLayoutsTests() void CreateLayoutsTests::init() { - std::unique_ptr< Calamares::JobQueue > jobqueue_p( new Calamares::JobQueue( nullptr ) ); + jobqueue = new Calamares::JobQueue( nullptr ); kpmcore = new CalamaresUtils::Partition::KPMManager(); } @@ -47,6 +48,7 @@ void CreateLayoutsTests::cleanup() { delete kpmcore; + delete jobqueue; } void