aboutsummaryrefslogtreecommitdiffstats
path: root/src/document/store.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/document/store.rs')
-rw-r--r--src/document/store.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/document/store.rs b/src/document/store.rs
index 8da6270..cd455b6 100644
--- a/src/document/store.rs
+++ b/src/document/store.rs
@@ -234,13 +234,19 @@ fn signs_values(doc: &impl ReadDoc) -> bool {
thread_local! {
static READING: std::cell::Cell<bool> = const { std::cell::Cell::new(false) };
}
+ // Unset when this returns, or unwinds.
+ struct Reading;
+ impl Drop for Reading {
+ fn drop(&mut self) {
+ READING.set(false);
+ }
+ }
if READING.get() {
return false;
}
READING.set(true);
- let strict = crate::access::policy::of(doc).strict();
- READING.set(false);
- strict
+ let _reading = Reading;
+ crate::access::policy::of(doc).strict()
}
/// Whether the values at `key` of `parents` are ordered by `seq`: at the policy's place,