From d67c18cc11b2e9dbdfb998cfb894d3bffebaafcd Mon Sep 17 00:00:00 2001 From: DQ Date: Fri, 5 Feb 2021 00:27:31 +0100 Subject: [PATCH] Bugfix `try_write` (#14) --- src/syntax.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/syntax.rs b/src/syntax.rs index 0b2966d..0e2a106 100644 --- a/src/syntax.rs +++ b/src/syntax.rs @@ -478,12 +478,11 @@ impl SyntaxNode { // overall. // safety: `node` was just created and has not been shared - let ref_count = unsafe { Box::from_raw(node.data().ref_count) }; + let ref_count = unsafe { &*node.data().ref_count }; ref_count.fetch_add(2, Ordering::AcqRel); let node_data = node.data; drop(node); unsafe { drop(Box::from_raw(node_data)) }; - drop(ref_count); } SyntaxElement::Token(token) => { // We don't have to worry about `NodeData` or `SyntaxToken`'s own `Drop` here,