From 204d7efc83c012c70e6a483f3a6e7a77a5d36b80 Mon Sep 17 00:00:00 2001 From: allexzander Date: Fri, 6 Aug 2021 13:16:52 +0300 Subject: [PATCH] Try not to close handles. Signed-off-by: allexzander --- src/libsync/vfs/cfapi/cfapiwrapper.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libsync/vfs/cfapi/cfapiwrapper.cpp b/src/libsync/vfs/cfapi/cfapiwrapper.cpp index 9c4c1470a51c7..57cbb8d8c6915 100644 --- a/src/libsync/vfs/cfapi/cfapiwrapper.cpp +++ b/src/libsync/vfs/cfapi/cfapiwrapper.cpp @@ -590,7 +590,7 @@ OCC::CfApiWrapper::FileHandle OCC::CfApiWrapper::handleForPath(const QString &pa HANDLE handle = nullptr; const qint64 openResult = CfOpenFileWithOplock(path.toStdWString().data(), CF_OPEN_FILE_FLAG_NONE, &handle); if (openResult == S_OK) { - return {handle, [](HANDLE h) { CfCloseHandle(h); }}; + return {handle, [](HANDLE h) {}}; } else { qCWarning(lcCfApiWrapper) << "Could not open handle for " << path << " result: " << QString::fromWCharArray(_com_error(openResult).ErrorMessage()); } @@ -599,7 +599,7 @@ OCC::CfApiWrapper::FileHandle OCC::CfApiWrapper::handleForPath(const QString &pa const auto handle = CreateFile(longpath.toStdWString().data(), 0, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (handle != INVALID_HANDLE_VALUE) { - return {handle, [](HANDLE h) { CloseHandle(h); }}; + return {handle, [](HANDLE h) {}}; } else { qCCritical(lcCfApiWrapper) << "Could not CreateFile for longpath:" << longpath << "with error:" << GetLastError(); }