1
0
mirror of synced 2025-01-31 03:53:44 +01:00

fix: Deadlock when loading recent files

This commit is contained in:
WerWolv 2022-12-28 23:06:27 +01:00
parent f7b988906e
commit cf601586fc
2 changed files with 3 additions and 3 deletions

View File

@ -110,7 +110,7 @@ namespace hex {
static void runWhenTasksFinished(const std::function<void()> &function);
private:
static std::mutex s_deferredCallsMutex;
static std::mutex s_deferredCallsMutex, s_tasksFinishedMutex;
static std::list<std::shared_ptr<Task>> s_tasks;
static std::list<std::shared_ptr<Task>> s_taskQueue;

View File

@ -8,7 +8,7 @@
namespace hex {
std::mutex TaskManager::s_deferredCallsMutex;
std::mutex TaskManager::s_deferredCallsMutex, TaskManager::s_tasksFinishedMutex;
std::list<std::shared_ptr<Task>> TaskManager::s_tasks, TaskManager::s_taskQueue;
std::list<std::function<void()>> TaskManager::s_deferredCalls;
@ -288,7 +288,7 @@ namespace hex {
}
void TaskManager::runWhenTasksFinished(const std::function<void()> &function) {
std::scoped_lock lock(s_deferredCallsMutex);
std::scoped_lock lock(s_tasksFinishedMutex);
s_tasksFinishedCallbacks.push_back(function);
}