summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2024-10-16 00:27:56 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2024-10-16 00:45:12 +0900
commit90a8800bb596cd98e103788096f2780ee97100b4 (patch)
tree65ba190e5e74b2eccedb4850ccf2e076109e8c28 /src
parent97f1dae2d1d95c4a499a844cf781de77a2eafa73 (diff)
downloadfzf-90a8800bb596cd98e103788096f2780ee97100b4.tar.gz
Avoid selecting an outdated merger from cache
We cache a merger for partial input as well, because it is automatically invalidated as soon as the new data comes in. However, there was a race condition where a cached merger for a partial input is used even after the input stream was complete. This commit fixes the problem. Fix #4034
Diffstat (limited to 'src')
-rw-r--r--src/matcher.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/matcher.go b/src/matcher.go
index 4e21f8ca..49d39730 100644
--- a/src/matcher.go
+++ b/src/matcher.go
@@ -102,7 +102,7 @@ func (m *Matcher) Loop() {
if !cacheCleared {
if count == prevCount {
// Look up mergerCache
- if cached, found := m.mergerCache[patternString]; found {
+ if cached, found := m.mergerCache[patternString]; found && cached.final == request.final {
merger = cached
}
} else {