and now to debug some SIGSEGVs

This commit is contained in:
🪞👃🪞 2024-07-24 15:12:48 +03:00
parent 24cfbfd959
commit cb181b0d86
4 changed files with 105 additions and 18 deletions

View file

@ -7,16 +7,11 @@ pub struct Host(*mut self::bound::SuilHost);
pub struct Instance(*mut self::bound::SuilInstance);
pub struct Controller(*mut self::bound::SuilController);
impl Host {
pub fn new () -> Self {
//let write = std::ptr::null();
//let index = std::ptr::null();
//let subscribe = std::ptr::null();
//let unsubscribe = std::ptr::null();
Self(unsafe {
bound::suil_init(&mut 0, std::ptr::null_mut(), 0);
let argv = &mut [] as *mut *mut *mut i8;
bound::suil_init(&mut 0, argv, 0);
bound::suil_host_new(
Some(Self::write),
Some(Self::index),
@ -40,9 +35,9 @@ impl Host {
fn set_touch_func (&self) {
unimplemented!();
}
fn instance (
fn instance <T> (
&self,
controller: &Controller,
controller: &mut T,
container_type_uri: &str,
plugin_uri: &str,
ui_uri: &str,
@ -60,7 +55,7 @@ impl Host {
Ok(Instance(unsafe {
bound::suil_instance_new(
self.0,
*controller.0,
controller as *mut _ as *mut std::ffi::c_void,
container_type_uri.into_raw(),
plugin_uri.into_raw(),
ui_uri.into_raw(),
@ -88,3 +83,7 @@ impl Drop for Instance {
}
}
}
unsafe impl Send for Instance {}
unsafe impl Sync for Instance {}