ui: Fixed escaping and interrupting

* Fixed crash when closing window with ESCAPE
* Fixed interrupt status message not showing when interrupting parsing
This commit is contained in:
Eberhard Graether
2016-03-10 11:47:33 +01:00
parent 66e8be4b4d
commit 527418fe2c
4 changed files with 12 additions and 7 deletions
+11 -4
View File
@@ -25,7 +25,15 @@ void TaskScheduler::pushTask(std::shared_ptr<Task> task)
void TaskScheduler::pushNextTask(std::shared_ptr<Task> task)
{
std::lock_guard<std::mutex> lock(m_tasksMutex);
m_tasks.push_front(task);
if (m_tasks.size() == 0)
{
m_tasks.push_front(task);
}
else
{
m_tasks.insert(m_tasks.begin() + 1, task);
}
}
void TaskScheduler::interruptCurrentTask()
@@ -142,15 +150,14 @@ void TaskScheduler::updateTasks()
while (m_tasks.size())
{
std::shared_ptr<Task> task = m_tasks.front();
m_tasks.pop_front();
m_tasksMutex.unlock();
Task::TaskState state = task->process(interrupt);
m_tasksMutex.lock();
if (state != Task::STATE_FINISHED && state != Task::STATE_CANCELED)
if (state == Task::STATE_FINISHED || state == Task::STATE_CANCELED)
{
m_tasks.push_front(task);
m_tasks.pop_front();
}
interrupt = m_interruptTask;