From 4e2fbc2b9ad3b45b47b803b8e0ffd8e3dcdf29ec Mon Sep 17 00:00:00 2001 From: Rubens Brandao Date: Mon, 22 Apr 2024 10:43:00 -0300 Subject: only create FlowGraph with Ref --- rust/src/flowgraph.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'rust/src/flowgraph.rs') diff --git a/rust/src/flowgraph.rs b/rust/src/flowgraph.rs index 9d95cc49..c2d4d559 100644 --- a/rust/src/flowgraph.rs +++ b/rust/src/flowgraph.rs @@ -114,8 +114,6 @@ impl<'a> ToOwned for FlowGraphNode<'a> { } } -// TODO : FlowGraph are RefCounted objects, this needs to be changed to only return Refs to FlowGraph - #[derive(PartialEq, Eq, Hash)] pub struct FlowGraph { pub(crate) handle: *mut BNFlowGraph, @@ -126,8 +124,8 @@ impl FlowGraph { Self { handle: raw } } - pub fn new() -> Self { - unsafe { FlowGraph::from_raw(BNCreateFlowGraph()) } + pub fn new() -> Ref { + unsafe { Ref::new(FlowGraph::from_raw(BNCreateFlowGraph())) } } pub fn append(&self, node: &FlowGraphNode) -> usize { -- cgit v1.3.1