From 724716ea335605dc1f9287c7cd9f88c709f6993c Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Tue, 7 Jan 2025 10:42:43 +0100 Subject: [PATCH] Tasktree: fix FTBFS due to unique_ptrs on forward-declared classes Some classes have circular dependencies: * RuntimeIteration depends on RuntimeTask * RuntimeContainer depends on RuntimeIteration * RuntimeTask depends on RuntimeContainer * TaskTreePrivate depends on RuntimeTask * RuntimeContainer depends on TaskTreePrivate Although there are a few std::unique_ptr deployed, the code at the moment does not fully solve the problem: the classes have an inline destructor, and the dependency has only been forward declared, resulting in a build error. Make some destructors out-of-line, and define them (as defaulted) late enough so that all the graph of classes has been seen, in order to fix the build. Change-Id: If150b92154061e915ebac920806717d2288c0638 Reviewed-by: Jarek Kobus (cherry picked from commit 71e53405a309684e4adcb8669a5f3d04319ad767) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit 3fda22bd8a45bfa5877994962af67e2b6b753043) --- src/assets/downloader/tasking/tasktree.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/assets/downloader/tasking/tasktree.cpp b/src/assets/downloader/tasking/tasktree.cpp index 8ff32ea0fe2..b89b0f52eee 100644 --- a/src/assets/downloader/tasking/tasktree.cpp +++ b/src/assets/downloader/tasking/tasktree.cpp @@ -1808,8 +1808,8 @@ class TaskTreePrivate Q_DISABLE_COPY_MOVE(TaskTreePrivate) public: - TaskTreePrivate(TaskTree *taskTree) - : q(taskTree) {} + explicit TaskTreePrivate(TaskTree *taskTree); + ~TaskTreePrivate(); void start(); void stop(); @@ -1906,6 +1906,7 @@ class RuntimeIteration public: RuntimeIteration(int index, RuntimeContainer *container); + ~RuntimeIteration(); std::optional loop() const; void deleteChild(RuntimeTask *node); @@ -1983,6 +1984,12 @@ public: std::unique_ptr m_task = {}; // Owning. }; +RuntimeIteration::~RuntimeIteration() = default; + +TaskTreePrivate::TaskTreePrivate(TaskTree *taskTree) + : q(taskTree) {} +TaskTreePrivate::~TaskTreePrivate() = default; + static bool isProgressive(RuntimeContainer *container) { RuntimeIteration *iteration = container->m_parentTask->m_parentIteration;