]> gitweb.factorcode.org Git - factor.git/commitdiff
cache: Don't use in-place filter
authorNiklas Larsson <niklas@mm.st>
Thu, 31 Oct 2019 12:34:42 +0000 (13:34 +0100)
committerDoug Coleman <doug.coleman@gmail.com>
Sat, 7 Mar 2020 05:14:44 +0000 (23:14 -0600)
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

index 4caa5b40acbd7f47570b753dd2a7314b99ce7094..f2e31d93698db8b359a8d2c342e334106fc0eb24 100644 (file)
@@ -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 ;