mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-28 07:47:03 -05:00
fix: Deadlock when loading recent files
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user