From e7512d4240f6038e6a4beda3d767fe8dbc14ca65 Mon Sep 17 00:00:00 2001 From: Niklas Larsson Date: Thu, 31 Oct 2019 13:34:42 +0100 Subject: [PATCH] cache: Don't use in-place filter This solves a UI corruption problem by not reusing the hashtable when purging the cache. The root cause of why the hashtable gets corrupted when filtering in place hasn't been found. Fixes #1978. --- basis/cache/cache.factor | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/basis/cache/cache.factor b/basis/cache/cache.factor index 4caa5b40ac..f2e31d9369 100644 --- a/basis/cache/cache.factor +++ b/basis/cache/cache.factor @@ -38,9 +38,9 @@ M: cache-assoc dispose* clear-assoc ; PRIVATE> : purge-cache ( cache -- ) - [ assoc>> ] [ max-age>> ] bi V{ } clone [ + dup [ assoc>> ] [ max-age>> ] bi V{ } clone [ '[ nip dup age>> 1 + [ >>age ] keep _ < [ drop t ] [ _ dispose-to f ] if - ] assoc-filter! drop + ] assoc-filter >>assoc drop ] keep [ last rethrow ] unless-empty ;