mmap: don't throw exceptions in destructor..

metadata
Wenzel Jakob 2013-11-27 12:49:03 +01:00
parent 96832ab70d
commit 73b6dc4ce2
1 changed files with 13 additions and 7 deletions

View File

@ -104,14 +104,20 @@ MemoryMappedFile::~MemoryMappedFile() {
#if defined(__LINUX__) || defined(__OSX__)
int retval = munmap(d->data, d->size);
if (retval != 0)
Log(EError, "munmap(): unable to unmap memory!");
Log(EWarn, "munmap(): unable to unmap memory!");
#elif defined(WIN32)
if (!UnmapViewOfFile(d->data))
Log(EError, "UnmapViewOfFile(): unable to unmap memory: %s", lastErrorText().c_str());
if (!CloseHandle(d->fileMapping))
Log(EError, "CloseHandle(): unable to close file mapping: %s", lastErrorText().c_str());
if (!CloseHandle(d->file))
Log(EError, "CloseHandle(): unable to close file: %s", lastErrorText().c_str());
if (!UnmapViewOfFile(d->data) {
Log(EWarn, "UnmapViewOfFile(): unable to unmap memory: %s", lastErrorText().c_str());
return;
}
if (!CloseHandle(d->fileMapping)) {
Log(EWarn, "CloseHandle(): unable to close file mapping: %s", lastErrorText().c_str());
return;
}
if (!CloseHandle(d->file)) {
Log(EWarn, "CloseHandle(): unable to close file: %s", lastErrorText().c_str());
return;
}
#endif
}
}