From df00e9545d3cbc37cca75646eff257e940a3d258 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 3 Jan 2021 12:13:08 +0530 Subject: [PATCH] Add some more ensure_state() --- kitty/disk-cache.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kitty/disk-cache.c b/kitty/disk-cache.c index e44b3f1ba..cadf068bb 100644 --- a/kitty/disk-cache.c +++ b/kitty/disk-cache.c @@ -532,6 +532,7 @@ remove_from_disk_cache(PyObject *self_, const void *key, size_t key_sz) { void clear_disk_cache(PyObject *self_) { DiskCache *self = (DiskCache*)self_; + if (!ensure_state(self)) return; CacheEntry *s, *tmp; mutex(lock); HASH_ITER(hh, self->entries, s, tmp) { @@ -607,6 +608,7 @@ end: bool disk_cache_wait_for_write(PyObject *self_, monotonic_t timeout) { DiskCache *self = (DiskCache*)self_; + if (!ensure_state(self)) return false; monotonic_t end_at = monotonic() + timeout; while (!timeout || monotonic() <= end_at) { bool pending = false;