From 3485eca4fe0f67b0d204f2ce63afff0fcacb9c94 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Tue, 14 May 2019 15:10:23 +0200 Subject: [PATCH] core/refs: fix drop condition --- nihav-core/src/refs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) -- 2.39.5