mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-17 05:48:44 +00:00
Handle race condition on get->set new cached string
overwrite add if it somehow was added from another thread in between lock checks
This commit is contained in:
parent
232a9de32e
commit
cce3d5d9f5
1 changed files with 2 additions and 2 deletions
|
@ -51,7 +51,7 @@ namespace PKHeX.Core
|
|||
// match found, cache result
|
||||
regMatch = pattern;
|
||||
lock (dictLock)
|
||||
Lookup.Add(msg, regMatch);
|
||||
Lookup[msg] = regMatch;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
if ((Lookup.Count & ~MAX_COUNT) != 0)
|
||||
Lookup.Clear(); // reset
|
||||
Lookup.Add(msg, regMatch = NoMatch);
|
||||
Lookup[msg] = regMatch = NoMatch;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue