summaryrefslogtreecommitdiff
path: root/plugins/warp
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2026-03-13 12:20:27 -0700
committerMason Reed <35282038+emesare@users.noreply.github.com>2026-03-24 18:46:48 -0700
commitc43ecea6535c12d8b04ca8cede1a35cb9fb66af9 (patch)
tree5b3da92fcf2178b7a7ff8eecf3d3f933a5bf9bf8 /plugins/warp
parenta40a300cce8a798200562e9d4515116360dbd0b1 (diff)
[Rust] Move `ObjectDestructor` to own module and add some extra documentation
Diffstat (limited to 'plugins/warp')
-rw-r--r--plugins/warp/src/cache.rs10
-rw-r--r--plugins/warp/src/plugin/debug.rs2
2 files changed, 4 insertions, 8 deletions
diff --git a/plugins/warp/src/cache.rs b/plugins/warp/src/cache.rs
index 3df2dbf8..d9a5a8d1 100644
--- a/plugins/warp/src/cache.rs
+++ b/plugins/warp/src/cache.rs
@@ -9,18 +9,14 @@ pub use type_reference::*;
use binaryninja::binary_view::{BinaryView, BinaryViewExt};
use binaryninja::function::Function as BNFunction;
+use binaryninja::object_destructor::{register_object_destructor, ObjectDestructor};
use binaryninja::rc::Guard;
use binaryninja::rc::Ref as BNRef;
-use binaryninja::ObjectDestructor;
use std::hash::{DefaultHasher, Hash, Hasher};
pub fn register_cache_destructor() {
- pub static mut CACHE_DESTRUCTOR: CacheDestructor = CacheDestructor;
- #[allow(static_mut_refs)]
- // SAFETY: This can be done as the backing data is an opaque ZST.
- unsafe {
- CACHE_DESTRUCTOR.register()
- };
+ let destructor = register_object_destructor(CacheDestructor);
+ std::mem::forget(destructor);
}
/// A unique view ID, used for caching.
diff --git a/plugins/warp/src/plugin/debug.rs b/plugins/warp/src/plugin/debug.rs
index d220d329..4198ea30 100644
--- a/plugins/warp/src/plugin/debug.rs
+++ b/plugins/warp/src/plugin/debug.rs
@@ -3,7 +3,7 @@ use crate::{build_function, cache};
use binaryninja::binary_view::BinaryView;
use binaryninja::command::{Command, FunctionCommand};
use binaryninja::function::Function;
-use binaryninja::ObjectDestructor;
+use binaryninja::object_destructor::ObjectDestructor;
pub struct DebugFunction;