Fixed a resource (file descriptor) leak: If a QFile object was created from a C Runti...
commitd888855e4a3fa166b3c8ae8e60c020f3d8195305
authorLoRd_MuldeR <mulder2@gmx.de>
Fri, 1 Nov 2013 18:32:47 +0000 (1 19:32 +0100)
committerLoRd_MuldeR <mulder2@gmx.de>
Fri, 1 Nov 2013 18:32:47 +0000 (1 19:32 +0100)
tree4d4e8f7362117cf66eb3b7af2c962127b9922a4c
parent2ea758c079c85c03f212a06d87a152d4f474da7a
Fixed a resource (file descriptor) leak: If a QFile object was created from a C Runtime file descriptor, it will *not* close the file, when QFile::close() is called or when the QFile object is destroyed. Furthermore, if a C Runtime file descriptor is obtained via _open_osfhandle(), we *must* to close that file descriptor via _close() function. Closing the underlying system HANDLE via CloseHandle() is *not* sufficient, as the file descriptor is won't be freed! On the other hand, the _close() function *does* close the underlying system HANDLE for us. In order to avoid a resource (file descriptor) leak, we will now store the file descriptor and close it properly via _close() in the destructor.

Note: The resource leak probably did not cause any harm, simply because we did not create many LockedFile objects. But it *did* cause serious issues when running the benchmark. Anyway, it should be fixed now.
doc/Changelog.html
src/LockedFile.cpp
src/LockedFile.h