1
0
mirror of synced 2024-11-24 15:50:16 +01:00

fix: File changed popup showing up when saving memory mapped file

This commit is contained in:
WerWolv 2024-03-15 17:57:06 +01:00
parent 3897245a7e
commit 0f4504476a
2 changed files with 7 additions and 0 deletions

View File

@ -67,6 +67,7 @@ namespace hex::plugin::builtin {
wolv::io::ChangeTracker m_changeTracker;
std::vector<u8> m_data;
bool m_loadedIntoMemory = false;
bool m_ignoreNextChangeEvent = false;
std::optional<struct stat> m_fileStats;

View File

@ -68,6 +68,7 @@ namespace hex::plugin::builtin {
void FileProvider::save() {
if (m_loadedIntoMemory) {
m_ignoreNextChangeEvent = true;
m_file.open();
m_file.writeVectorAtomic(0x00, m_data);
m_file.setSize(m_data.size());
@ -333,6 +334,11 @@ namespace hex::plugin::builtin {
}
void FileProvider::handleFileChange() {
if (m_ignoreNextChangeEvent) {
m_ignoreNextChangeEvent = false;
return;
}
ui::PopupQuestion::open("hex.builtin.provider.file.reload_changes"_lang, [this] {
this->close();
(void)this->open();