From: Kostya Shishkov Date: Tue, 14 May 2019 13:10:23 +0000 (+0200) Subject: core/refs: fix drop condition X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=3485eca4fe0f67b0d204f2ce63afff0fcacb9c94;p=nihav.git core/refs: fix drop condition --- diff --git a/nihav-core/src/refs.rs b/nihav-core/src/refs.rs index de1c4fc..023a213 100644 --- a/nihav-core/src/refs.rs +++ b/nihav-core/src/refs.rs @@ -18,7 +18,7 @@ impl NABufferData { obj.refs.fetch_add(1, Ordering::SeqCst); } fn dec_refs(obj: &mut Self) -> bool { - obj.refs.fetch_sub(1, Ordering::SeqCst) == 0 + obj.refs.fetch_sub(1, Ordering::SeqCst) == 1 } fn get_num_refs(obj: &Self) -> usize { obj.refs.load(Ordering::Relaxed)