forked from qt-creator/qt-creator
TaskTree: Ensure the same storage isn't added twice
Change-Id: I780d61091fea39a4542b4f743593b5062a784ba5 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -268,11 +268,22 @@ public:
|
|||||||
GuardLocker locker(m_guard);
|
GuardLocker locker(m_guard);
|
||||||
emit q->errorOccurred();
|
emit q->errorOccurred();
|
||||||
}
|
}
|
||||||
|
QList<TreeStorageBase> addStorages(const QList<TreeStorageBase> &storages) {
|
||||||
|
QList<TreeStorageBase> addedStorages;
|
||||||
|
for (const TreeStorageBase &storage : storages) {
|
||||||
|
QTC_ASSERT(!m_storages.contains(storage), qWarning("Can't add the same storage into "
|
||||||
|
"one TaskTree twice, skipping..."); continue);
|
||||||
|
addedStorages << storage;
|
||||||
|
m_storages << storage;
|
||||||
|
}
|
||||||
|
return addedStorages;
|
||||||
|
}
|
||||||
|
|
||||||
TaskTree *q = nullptr;
|
TaskTree *q = nullptr;
|
||||||
std::unique_ptr<TaskNode> m_root = nullptr;
|
std::unique_ptr<TaskNode> m_root = nullptr;
|
||||||
Guard m_guard;
|
Guard m_guard;
|
||||||
int m_progressValue = 0;
|
int m_progressValue = 0;
|
||||||
|
QSet<TreeStorageBase> m_storages;
|
||||||
};
|
};
|
||||||
|
|
||||||
TaskContainer::TaskContainer(TaskTreePrivate *taskTreePrivate, TaskContainer *parentContainer,
|
TaskContainer::TaskContainer(TaskTreePrivate *taskTreePrivate, TaskContainer *parentContainer,
|
||||||
@@ -282,7 +293,7 @@ TaskContainer::TaskContainer(TaskTreePrivate *taskTreePrivate, TaskContainer *pa
|
|||||||
, m_executeMode(task.executeMode())
|
, m_executeMode(task.executeMode())
|
||||||
, m_workflowPolicy(task.workflowPolicy())
|
, m_workflowPolicy(task.workflowPolicy())
|
||||||
, m_groupHandler(task.groupHandler())
|
, m_groupHandler(task.groupHandler())
|
||||||
, m_storageList(task.storageList())
|
, m_storageList(taskTreePrivate->addStorages(task.storageList()))
|
||||||
{
|
{
|
||||||
const QList<TaskItem> &children = task.children();
|
const QList<TaskItem> &children = task.children();
|
||||||
for (const TaskItem &child : children) {
|
for (const TaskItem &child : children) {
|
||||||
|
Reference in New Issue
Block a user