- fix crash if a worker thread is the first thread to queue drawer commands

This commit is contained in:
Magnus Norddahl 2017-03-14 23:47:41 +01:00
parent 3838ec3edc
commit 93908bc2ef

View file

@ -59,11 +59,11 @@ void DrawerThreads::Execute(DrawerCommandQueuePtr commands)
return; return;
auto queue = Instance(); auto queue = Instance();
queue->StartThreads();
// Add to queue and awaken worker threads // Add to queue and awaken worker threads
std::unique_lock<std::mutex> start_lock(queue->start_mutex); std::unique_lock<std::mutex> start_lock(queue->start_mutex);
std::unique_lock<std::mutex> end_lock(queue->end_mutex); std::unique_lock<std::mutex> end_lock(queue->end_mutex);
queue->StartThreads();
queue->active_commands.push_back(commands); queue->active_commands.push_back(commands);
queue->tasks_left += queue->threads.size(); queue->tasks_left += queue->threads.size();
end_lock.unlock(); end_lock.unlock();