From e33a434bd48254e5195a3f03da59efef66e9e3dd Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Sat, 16 Sep 2017 11:45:10 +0200 Subject: [PATCH] Fixed issue #3055: Explorer crash when deleting two independent folders Don't open the command pipe with the overlapped flag, since access to it is done without the overlapped object. Based on TortoiseSVN rev. 27954. Signed-off-by: Sven Strickroth --- src/Changelog.txt | 1 + src/TortoiseShell/RemoteCacheLink.cpp | 13 ++++++------- src/TortoiseShell/RemoteCacheLink.h | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Changelog.txt b/src/Changelog.txt index 1e1814ccf..e6684267e 100644 --- a/src/Changelog.txt +++ b/src/Changelog.txt @@ -12,6 +12,7 @@ Released: unreleased * Fixed issue #3066: Message field needs vertical scrollbar in Create Tag dialog * Fixed issue #3033: Cannot view submodule log if repository sits under directory symlink Update libgit to 2.14.1 based on Git for Windows source. + * Fixed issue #3055: Explorer crash when deleting two independent folders = Release 2.5.0 = Released: 2017-07-23 diff --git a/src/TortoiseShell/RemoteCacheLink.cpp b/src/TortoiseShell/RemoteCacheLink.cpp index 132f604fd..9ea99fde3 100644 --- a/src/TortoiseShell/RemoteCacheLink.cpp +++ b/src/TortoiseShell/RemoteCacheLink.cpp @@ -1,7 +1,7 @@ // TortoiseGit - a Windows shell extension for easy version control // Copyright (C) 2009-2014, 2016-2017 - TortoiseGit -// Copyright (C) 2003-2014 - TortoiseSVN +// Copyright (C) 2003-2014, 2017 - TortoiseSVN // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -39,8 +39,7 @@ CRemoteCacheLink::~CRemoteCacheLink(void) m_critSec.Term(); } -bool CRemoteCacheLink::InternalEnsurePipeOpen ( CAutoFile& hPipe - , const CString& pipeName) const +bool CRemoteCacheLink::InternalEnsurePipeOpen(CAutoFile& hPipe, const CString& pipeName, bool overlapped) const { if (hPipe) return true; @@ -56,7 +55,7 @@ bool CRemoteCacheLink::InternalEnsurePipeOpen ( CAutoFile& hPipe 0, // no sharing nullptr, // default security attributes OPEN_EXISTING, // opens existing pipe - FILE_FLAG_OVERLAPPED, // default attributes + overlapped ? FILE_FLAG_OVERLAPPED : 0, // default attributes nullptr); // no template file if ((!hPipe) && (GetLastError() == ERROR_PIPE_BUSY)) { @@ -92,7 +91,7 @@ bool CRemoteCacheLink::EnsurePipeOpen() { AutoLocker lock(m_critSec); - if (InternalEnsurePipeOpen (m_hPipe, GetCachePipeName())) + if (InternalEnsurePipeOpen(m_hPipe, GetCachePipeName(), true)) { // create an unnamed (=local) manual reset event for use in the overlapped structure if (m_hEvent) @@ -111,8 +110,7 @@ bool CRemoteCacheLink::EnsurePipeOpen() bool CRemoteCacheLink::EnsureCommandPipeOpen() { - AutoLocker lock(m_critSec); - return InternalEnsurePipeOpen (m_hCommandPipe, GetCacheCommandPipeName()); + return InternalEnsurePipeOpen(m_hCommandPipe, GetCacheCommandPipeName(), false); } void CRemoteCacheLink::ClosePipe() @@ -236,6 +234,7 @@ bool CRemoteCacheLink::GetStatusFromRemoteCache(const CTGitPath& Path, TGITCache bool CRemoteCacheLink::ReleaseLockForPath(const CTGitPath& path) { + AutoLocker lock(m_critSec); EnsureCommandPipeOpen(); if (m_hCommandPipe) { diff --git a/src/TortoiseShell/RemoteCacheLink.h b/src/TortoiseShell/RemoteCacheLink.h index 725cf7a21..bf52965c9 100644 --- a/src/TortoiseShell/RemoteCacheLink.h +++ b/src/TortoiseShell/RemoteCacheLink.h @@ -1,6 +1,6 @@ // TortoiseGit - a Windows shell extension for easy version control -// Copyright (C) 2003-2011, 2014 - TortoiseSVN +// Copyright (C) 2003-2011, 2014, 2017 - TortoiseSVN // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -39,7 +39,7 @@ public: bool ReleaseLockForPath(const CTGitPath& path); private: - bool InternalEnsurePipeOpen (CAutoFile& hPipe, const CString& pipeName) const; + bool InternalEnsurePipeOpen(CAutoFile& hPipe, const CString& pipeName, bool overlapped) const; bool EnsurePipeOpen(); void ClosePipe(); -- 2.11.4.GIT