We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7d85925 commit 3bd502bCopy full SHA for 3bd502b
src/lib.rs
@@ -133,16 +133,12 @@ impl Isolate {
133
pub fn post(&self, msg: impl IntoDart) -> bool {
134
if let Some(func) = POST_COBJECT.load(Ordering::Relaxed) {
135
unsafe {
136
- let boxed_msg = Box::new(msg.into_dart());
137
- let ptr = Box::into_raw(boxed_msg);
+ let mut msg = msg.into_dart();
138
// Send the message
139
- let result = func(self.port, ptr);
140
- // free the object
141
- let mut boxed_obj = Box::from_raw(ptr);
+ let result = func(self.port, &mut msg);
142
if !result {
143
- ffi::run_destructors(boxed_obj.as_mut())
+ ffi::run_destructors(&msg);
144
}
145
- drop(boxed_obj);
146
// I like that dance haha
147
result
148
0 commit comments