fix: Race condition when loading projects while other providers are loaded already
This commit is contained in:
parent
b1b54a5fe7
commit
82f1d08dd7
@ -26,6 +26,8 @@
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
static std::mutex s_openCloseMutex;
|
||||
|
||||
using namespace wolv::literals;
|
||||
|
||||
std::set<FileProvider*> FileProvider::s_openedFiles;
|
||||
@ -247,6 +249,8 @@ namespace hex::plugin::builtin {
|
||||
ui::ToastInfo::open("hex.builtin.popup.error.read_only"_lang);
|
||||
}
|
||||
|
||||
std::scoped_lock lock(s_openCloseMutex);
|
||||
|
||||
m_file = std::move(file);
|
||||
m_fileStats = m_file.getFileInfo();
|
||||
m_fileSize = m_file.getSize();
|
||||
@ -284,6 +288,8 @@ namespace hex::plugin::builtin {
|
||||
|
||||
|
||||
void FileProvider::close() {
|
||||
std::scoped_lock lock(s_openCloseMutex);
|
||||
|
||||
m_file.close();
|
||||
m_data.clear();
|
||||
s_openedFiles.erase(this);
|
||||
|
Loading…
x
Reference in New Issue
Block a user