diff --git a/source/helpers/project_file_handler.cpp b/source/helpers/project_file_handler.cpp index 224e40b9a..d8f68c17f 100644 --- a/source/helpers/project_file_handler.cpp +++ b/source/helpers/project_file_handler.cpp @@ -53,6 +53,8 @@ namespace hex { ProjectFile::s_currProjectFilePath = filePath; + EventManager::post(); + return true; } @@ -85,8 +87,6 @@ namespace hex { ProjectFile::s_hasUnsavedChanged = false; ProjectFile::s_currProjectFilePath = filePath; - EventManager::post(); - return true; } diff --git a/source/providers/file_provider.cpp b/source/providers/file_provider.cpp index c222b8c78..42b848796 100644 --- a/source/providers/file_provider.cpp +++ b/source/providers/file_provider.cpp @@ -91,10 +91,11 @@ namespace hex::prv { File file(path, File::Mode::Create); if (file.isValid()) { - std::vector buffer(std::min(0xFF'FFFF, file.getSize()), 0x00); + auto provider = ImHexApi::Provider::get(); + + std::vector buffer(std::min(0xFF'FFFF, provider->getActualSize()), 0x00); size_t bufferSize = buffer.size(); - auto provider = ImHexApi::Provider::get(); for (u64 offset = 0; offset < provider->getActualSize(); offset += bufferSize) { if (bufferSize > provider->getActualSize() - offset) bufferSize = provider->getActualSize() - offset;