1
0
mirror of synced 2025-02-15 10:02:36 +01:00

fix: Crash on macOS when dirtying or undirtying a provider from a thread

Fixes #1799
This commit is contained in:
WerWolv 2024-07-05 20:59:20 +02:00
parent 1c2bb0c049
commit 22dc3c6589

View File

@ -5,6 +5,7 @@
#include <hex/api/project_file_manager.hpp> #include <hex/api/project_file_manager.hpp>
#include <hex/api/imhex_api.hpp> #include <hex/api/imhex_api.hpp>
#include <hex/api/event_manager.hpp> #include <hex/api/event_manager.hpp>
#include <hex/api/task_manager.hpp>
#include <hex/helpers/utils_macos.hpp> #include <hex/helpers/utils_macos.hpp>
#include <hex/helpers/logger.hpp> #include <hex/helpers/logger.hpp>
@ -65,8 +66,10 @@ namespace hex {
}); });
EventProviderDirtied::subscribe([this](prv::Provider *) { EventProviderDirtied::subscribe([this](prv::Provider *) {
TaskManager::doLater([] {
macosMarkContentEdited(m_window); macosMarkContentEdited(m_window);
}); });
});
ProjectFile::registerHandler({ ProjectFile::registerHandler({
.basePath = "", .basePath = "",
@ -75,7 +78,10 @@ namespace hex {
return true; return true;
}, },
.store = [this](const std::fs::path &, Tar &) { .store = [this](const std::fs::path &, Tar &) {
TaskManager::doLater([] {
macosMarkContentEdited(m_window, false); macosMarkContentEdited(m_window, false);
});
return true; return true;
} }
}); });