From 77679790dbcb51f1cf524ee2c737ee19fc63eb49 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Wed, 6 May 2015 15:51:41 +0200 Subject: [PATCH] shell_integration on Windows: Don't fill the cache with unsolicited statuses #3122 Only keep the status updates if explorer is going to display it. --- .../windows/OCUtil/RemotePathChecker.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/shell_integration/windows/OCUtil/RemotePathChecker.cpp b/shell_integration/windows/OCUtil/RemotePathChecker.cpp index 161163de1..0dda64609 100644 --- a/shell_integration/windows/OCUtil/RemotePathChecker.cpp +++ b/shell_integration/windows/OCUtil/RemotePathChecker.cpp @@ -115,13 +115,16 @@ void RemotePathChecker::workerThreadLoop() auto responseStatus = response.substr(statusBegin+1, statusEnd - statusBegin-1); auto responsePath = response.substr(statusEnd+1); auto state = _StrToFileState(responseStatus); - auto erased = asked.erase(responsePath); + bool wasAsked = asked.erase(responsePath) > 0; bool changed = false; { std::unique_lock lock(_mutex); - auto &it = _cache[responsePath]; - changed = (it != state); - it = state; + bool wasCached = _cache.find(responsePath) != _cache.end(); + if (wasAsked || wasCached) { + auto &it = _cache[responsePath]; + changed = (it != state); + it = state; + } } if (changed) { SHChangeNotify(SHCNE_UPDATEITEM, SHCNF_PATH | SHCNF_FLUSHNOWAIT, responsePath.data(), NULL); -- 2.30.2