diff options
Diffstat (limited to 'src/system')
-rw-r--r-- | src/system/MemoryMappedFile.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/system/MemoryMappedFile.cpp b/src/system/MemoryMappedFile.cpp index 54f15c1..c823cb5 100644 --- a/src/system/MemoryMappedFile.cpp +++ b/src/system/MemoryMappedFile.cpp @@ -12,8 +12,12 @@ namespace mgl { } bool MemoryMappedFile::load(const char *filepath, LoadOptions load_options) { - if(memory_mapped_file.fd != -1) - return false; + if(memory_mapped_file.fd != -1) { + mgl_mapped_file_unload(&memory_mapped_file); + memory_mapped_file.data = nullptr; + memory_mapped_file.size = 0; + memory_mapped_file.fd = -1; + } mgl_memory_mapped_file_load_options mapped_file_load_options = { load_options.readable, |