1
0
mirror of synced 2024-11-24 07:40:17 +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 bb0a8047ea
commit 88e2fa04e7

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,7 +66,9 @@ namespace hex {
}); });
EventProviderDirtied::subscribe([this](prv::Provider *) { EventProviderDirtied::subscribe([this](prv::Provider *) {
macosMarkContentEdited(m_window); TaskManager::doLater([] {
macosMarkContentEdited(m_window);
});
}); });
ProjectFile::registerHandler({ ProjectFile::registerHandler({
@ -75,7 +78,10 @@ namespace hex {
return true; return true;
}, },
.store = [this](const std::fs::path &, Tar &) { .store = [this](const std::fs::path &, Tar &) {
macosMarkContentEdited(m_window, false); TaskManager::doLater([] {
macosMarkContentEdited(m_window, false);
});
return true; return true;
} }
}); });