-
-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
frida: clarify runtime lifetimes #160
base: main
Are you sure you want to change the base?
Conversation
Also introduces an abstraction around GObject to try to more appropriately capture the situation.
} | ||
|
||
/// Returns the device's name. | ||
pub fn get_name(&self) -> &str { | ||
let name = | ||
unsafe { CStr::from_ptr(frida_sys::frida_device_get_name(self.device_ptr) as _) }; | ||
let name = unsafe { CStr::from_ptr(frida_sys::frida_device_get_name(self.0.ptr()) as _) }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this not call the ptr()
function above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for the rest of the self.0.ptr()
calls...
pub struct DeviceManager<'a> { | ||
#[derive(Clone)] | ||
pub struct DeviceManager { | ||
frida: Frida, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we call this frida
here, but runtime()
above... Let's choose one and stick with it.
} | ||
} | ||
|
||
static THE_ONE_TRUE_FRIDA: Mutex<Option<Arc<FridaSingleton>>> = Mutex::new(None); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this name is cute and pithy, would be better to call it FRIDA_SINGLETON
, I think.
ptr | ||
} | ||
|
||
pub(crate) fn new(ptr: *mut T, runtime: RT) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps this should be called from_raw
?
@@ -85,7 +72,7 @@ impl<'a> SpawnOptions<'a> { | |||
let mut arg_ptrs: Vec<*mut _> = args.iter().map(|s| s.as_ptr() as *mut _).collect(); | |||
unsafe { | |||
frida_sys::frida_spawn_options_set_argv( | |||
self.options_ptr, | |||
self.0.ptr(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.ptr()
, no?
Also introduces an abstraction around GObject to try to more appropriately capture the situation.