Merge pull request #784 from flowln/fix_resource_folder_double_smart_ptrs
This commit is contained in:
parent
4827f7e317
commit
16b48866f4
@ -260,7 +260,7 @@ void ResourceFolderModel::resolveResource(Resource* res)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto task = createParseTask(*res);
|
Task::Ptr task{ createParseTask(*res) };
|
||||||
if (!task)
|
if (!task)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -270,11 +270,11 @@ void ResourceFolderModel::resolveResource(Resource* res)
|
|||||||
m_active_parse_tasks.insert(ticket, task);
|
m_active_parse_tasks.insert(ticket, task);
|
||||||
|
|
||||||
connect(
|
connect(
|
||||||
task, &Task::succeeded, this, [=] { onParseSucceeded(ticket, res->internal_id()); }, Qt::ConnectionType::QueuedConnection);
|
task.get(), &Task::succeeded, this, [=] { onParseSucceeded(ticket, res->internal_id()); }, Qt::ConnectionType::QueuedConnection);
|
||||||
connect(
|
connect(
|
||||||
task, &Task::failed, this, [=] { onParseFailed(ticket, res->internal_id()); }, Qt::ConnectionType::QueuedConnection);
|
task.get(), &Task::failed, this, [=] { onParseFailed(ticket, res->internal_id()); }, Qt::ConnectionType::QueuedConnection);
|
||||||
connect(
|
connect(
|
||||||
task, &Task::finished, this, [=] { m_active_parse_tasks.remove(ticket); }, Qt::ConnectionType::QueuedConnection);
|
task.get(), &Task::finished, this, [=] { m_active_parse_tasks.remove(ticket); }, Qt::ConnectionType::QueuedConnection);
|
||||||
|
|
||||||
m_helper_thread_task.addTask(task);
|
m_helper_thread_task.addTask(task);
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ void ConcurrentTask::startNext()
|
|||||||
QMetaObject::invokeMethod(next.get(), &Task::start, Qt::QueuedConnection);
|
QMetaObject::invokeMethod(next.get(), &Task::start, Qt::QueuedConnection);
|
||||||
|
|
||||||
// Allow going up the number of concurrent tasks in case of tasks being added in the middle of a running task.
|
// Allow going up the number of concurrent tasks in case of tasks being added in the middle of a running task.
|
||||||
int num_starts = m_total_max_size - m_doing.size();
|
int num_starts = qMin(m_queue.size(), m_total_max_size - m_doing.size());
|
||||||
for (int i = 0; i < num_starts; i++)
|
for (int i = 0; i < num_starts; i++)
|
||||||
QMetaObject::invokeMethod(this, &ConcurrentTask::startNext, Qt::QueuedConnection);
|
QMetaObject::invokeMethod(this, &ConcurrentTask::startNext, Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user