1
Fork 0
mirror of https://github.com/RGBCube/cstree synced 2025-07-27 09:07:44 +00:00

Bugfix try_write (#14)

This commit is contained in:
DQ 2021-02-05 00:27:31 +01:00 committed by GitHub
parent fb463aef18
commit d67c18cc11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -478,12 +478,11 @@ impl<L: Language, D, R> SyntaxNode<L, D, R> {
// 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<L>`'s own `Drop` here,