From 5cadce5000a44b4491b44898d3056cd626e6189c Mon Sep 17 00:00:00 2001 From: lizhuoan Date: Tue, 5 Sep 2023 17:19:16 +0800 Subject: [PATCH] =?UTF-8?q?fix=20bug=20190889,=E5=85=81=E8=AE=B8=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E5=B9=B6=E8=A1=8C=E6=97=B6=EF=BC=8C=E5=86=8D=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E5=8F=A61=E4=B8=AA=E5=A4=A7=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E5=A4=8D=E5=88=B6=E6=97=B6=EF=BC=8C=E6=9C=AA?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E5=B9=B6=E8=A1=8C=E5=A4=8D=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libpeony-qt/file-copy.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libpeony-qt/file-copy.cpp b/libpeony-qt/file-copy.cpp index 9caba3e8..5c8ee504 100644 --- a/libpeony-qt/file-copy.cpp +++ b/libpeony-qt/file-copy.cpp @@ -517,7 +517,8 @@ int FileCopy::doCopyBigFile(const char *srcPath, const char *destPath) off_t offset = 0; int syncCount = 0; - std::lock_guard lock(fileMutex); + std::unique_lock lock(fileMutex, std::defer_lock); + lock.lock(); in_fd = open(srcPath, O_RDONLY); if (in_fd == -1) { qDebug() << "Failed to open the source file"; @@ -528,7 +529,7 @@ int FileCopy::doCopyBigFile(const char *srcPath, const char *destPath) qDebug() << "Failed to get the source file status"; return ret; } - + lock.unlock(); out_fd = open(destPath, O_WRONLY | O_CREAT, stat_buf.st_mode); if (out_fd == -1) { qDebug() << "Failed to open the destination file";