[PATCH] ShellCache: Fix IsContextPathAllowed() to use latest configuration
Benjamin Robin via TortoiseSVN-dev <[email protected]>
| Newsgroups | gmane.comp.version-control.subversion.tortoisesvn.devel |
|---|---|
| Message-ID | <[email protected]> |
IsContextPathAllowed() calls ExcludeContextValid() to update excontextvector. But ExcludeContextValid() almost never do it, since it was checking for the return of RefreshIfNeeded(). The registry event my have been consumed by another ShellCache function just before calling ExcludeContextValid(). When starting (When explorer is launched), excludecontextstr and excontextvector are empty. And they will stay empty forever since the registry is not going to change (require a setting change I guess). So remove the return check to RefreshIfNeeded(), which is not needed, there is already a check to prevent to compute every time excontextvector, . Also do not take the lock, it was already taken by the caller. See also https://github.com/TortoiseGit/TortoiseGit/pull/238 -- You received this message because you are subscribed to the Google Groups "TortoiseSVN-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/tortoisesvn-dev/34db3b86-c11c-4e08-a2b7-b94a835e3da9n%40googlegroups.com.
ShellCache-ExcludeContextValid.c
(text/x-csrc, 872 B)
void ShellCache::ExcludeContextValid()
{
// Lock must be taken by caller, which is done by IsContextPathAllowed()
RefreshIfNeeded();
if (excludecontextstr.compare((tstring)nocontextpaths) == 0)
return;
excludecontextstr = (tstring)nocontextpaths;
excontextvector.clear();
size_t pos = 0, pos_ant = 0;
pos = excludecontextstr.find(L'\n', pos_ant);
while (pos != tstring::npos)
{
tstring token = excludecontextstr.substr(pos_ant, pos - pos_ant);
if (!token.empty())
excontextvector.push_back(token);
pos_ant = pos + 1;
pos = excludecontextstr.find(L'\n', pos_ant);
}
if (!excludecontextstr.empty())
{
tstring token = excludecontextstr.substr(pos_ant, excludecontextstr.size() - 1);
if (!token.empty())
excontextvector.push_back(token);
}
}
ShellCache.patch
(text/x-patch, 1.9 KB)
--- a/ShellCache.cpp 2021-04-10 12:28:27.519319300 +0200
+++ b/ShellCache.cpp 2021-04-10 12:26:52.890000321 +0200
@@ -442,30 +442,28 @@
void ShellCache::ExcludeContextValid()
{
- if (RefreshIfNeeded())
+ // Lock must be taken by caller, which is done by IsContextPathAllowed()
+ RefreshIfNeeded();
+ if (excludecontextstr.compare((tstring)nocontextpaths) == 0)
+ return;
+
+ excludecontextstr = (tstring)nocontextpaths;
+ excontextvector.clear();
+ size_t pos = 0, pos_ant = 0;
+ pos = excludecontextstr.find(L'\n', pos_ant);
+ while (pos != tstring::npos)
{
- Locker lock(m_critSec);
- if (excludecontextstr.compare((tstring)nocontextpaths) == 0)
- return;
- excludecontextstr = (tstring)nocontextpaths;
- excontextvector.clear();
- size_t pos = 0, pos_ant = 0;
+ tstring token = excludecontextstr.substr(pos_ant, pos - pos_ant);
+ if (!token.empty())
+ excontextvector.push_back(token);
+ pos_ant = pos + 1;
pos = excludecontextstr.find(L'\n', pos_ant);
- while (pos != tstring::npos)
- {
- tstring token = excludecontextstr.substr(pos_ant, pos - pos_ant);
- if (!token.empty())
- excontextvector.push_back(token);
- pos_ant = pos + 1;
- pos = excludecontextstr.find(L'\n', pos_ant);
- }
- if (!excludecontextstr.empty())
- {
- tstring token = excludecontextstr.substr(pos_ant, excludecontextstr.size() - 1);
- if (!token.empty())
- excontextvector.push_back(token);
- }
- excludecontextstr = (tstring)nocontextpaths;
+ }
+ if (!excludecontextstr.empty())
+ {
+ tstring token = excludecontextstr.substr(pos_ant, excludecontextstr.size() - 1);
+ if (!token.empty())
+ excontextvector.push_back(token);
}
}