fix: Modified bytes visually reverting back after saving (#1003)

Fix #988

Co-authored-by: Nik <werwolv98@gmail.com>
This commit is contained in:
Thomas
2023-04-01 11:18:03 +02:00
committed by GitHub
parent 24106b860a
commit af18ca011b
2 changed files with 14 additions and 1 deletions

View File

@@ -77,7 +77,8 @@ namespace hex::plugin::builtin {
writeFile.seek(offset);
writeFile.writeBuffer(reinterpret_cast<const u8*>(buffer), size);
this->m_files.clear();
this->invalidateFiles();
}
void FileProvider::save() {
@@ -124,6 +125,13 @@ namespace hex::plugin::builtin {
Provider::insert(offset, size);
}
void FileProvider::invalidateFiles() {
for(auto & [threadId, file] : this->m_files){
file.close();
}
this->m_files.clear();
}
void FileProvider::remove(u64 offset, size_t size) {
auto oldSize = this->getActualSize();
this->resize(oldSize + size);