Skip to content

Commit

Permalink
fix(WinFile): File invalidation didn't take into account memory maps
Browse files Browse the repository at this point in the history
This made the move constructor useless if you memory mapped something because the destructor would always try to unmap which meant the map is no longer valid which meant it was impossible to pass around a memory map.
  • Loading branch information
UE4SS committed May 31, 2024
1 parent 7ce9870 commit 90b10ea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions assets/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ Fixed a crash caused by a race condition enabled by C++ mods using `UE4SS_ENABLE

Fixed the `std::span` returned by `FileHandle::memory_map` being improperly sized. ([UE4SS #507](https://github.com/UE4SS-RE/RE-UE4SS/pull/507))

Fixed 'File::Handle' unable to be moved if used in conjunction with memory_map. ([UE4SS #544](https://github.com/UE4SS-RE/RE-UE4SS/pull/544))

### BPModLoader
Fixed "bad conversion" errors ([UE4SS #398](https://github.com/UE4SS-RE/RE-UE4SS/pull/398))

Expand Down
2 changes: 2 additions & 0 deletions deps/first/File/src/FileType/WinFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ namespace RC::File
auto WinFile::invalidate_file() noexcept -> void
{
m_file = nullptr;
m_map_handle = nullptr;
m_memory_map = nullptr;
}

auto WinFile::delete_file(const std::filesystem::path& file_path_and_name) -> void
Expand Down

0 comments on commit 90b10ea

Please sign in to comment.