Fix windows specific behavior of FileMap

The implementation of the FileMap destructor would
close the file, only on Windows, which did not match
the behavior on mac/linux.

This is because calling munmap does not close the file
descriptor. It must be closed separately, before or after
munmap.

On Windows, the file must also be closed manually,
before or after closing the mappingFile.

The change basically removes the closing file from
the windows-specific part of the destructor, to
make behavior more consistent on all platforms
where the caller to FileMap is responsible for closing
its own file (since FileMap receives an opened file).

Change-Id: I5e3cfffbb870d5f3595802ccac57dbc1dbf1ce6e
This commit is contained in:
Xavier Ducrohet 2014-10-16 10:14:58 -07:00
parent 67f46cb0e1
commit 1a55aa5e34

View file

@ -77,7 +77,6 @@ FileMap::~FileMap(void)
if (mFileMapping != INVALID_HANDLE_VALUE) {
CloseHandle(mFileMapping);
}
CloseHandle(mFileHandle);
#endif
}