-
-
Notifications
You must be signed in to change notification settings - Fork 62
Conversation
Good for me. Thanks @EPashkin! |
We can do better. I consider |
Then we need at minimum these changes:
|
I don't like part about |
Yes, something along those lines. Typically the trampolines do something unsafe (at least transmute the argument) so there is some justification for their being Here had the function not been let _guard = CallbackGuard::new();
unsafe {
let func: &RefCell<Box<FnMut() -> Continue + 'static>> = transmute(func);
(&mut *func.borrow_mut())().to_glib()
} Finally, keeping the |
On nightly build safe trampolines don't convert automatically to unsafe:
|
Yes, unfortunately rustc is not smart enough in this case: while let trampoline: extern fn(gpointer) = trampoline;
g_idle_add_full(..., Some(trampoline), ...) |
Yes it accept it with |
|
Yeah looks like |
So what variant use in glib? |
or
or something other? |
I'm happy with both. Personally I'd go for the second style because it's shorter and I don't think having whole |
c6707b5
to
52b1b6d
Compare
Updated. |
Thanks! |
Don't use transmute on trampoline
Fix warning introduced rust-lang/rust#19925
See gtk-rs/gtk#278