Skip to content
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

Allow nullable trampolines with scope="call" #747

Merged
merged 1 commit into from Apr 15, 2019

Conversation

Projects
None yet
4 participants
@EPashkin
Copy link
Member

commented Apr 14, 2019

Part of gtk-rs/gdk#287

changes only in gdk:

--- a/src/auto/seat.rs
+++ b/src/auto/seat.rs
@@ -91,7 +91,7 @@ impl Seat {
                 panic!("cannot get closure...")
             };
         }
-        let prepare_func = Some(prepare_func_func::<P> as _);
+        let prepare_func = if prepare_func_data.is_some() { Some(prepare_func_func::<P> as _) } else { None };
         let super_callback0: &Option<&mut dyn (FnMut(&Seat, &Window))> = &prepare_func_data;
         unsafe {
             from_glib(gdk_sys::gdk_seat_grab(self.to_glib_none().0, window.as_ref().to_glib_none().0, capabilities.to_glib(), owner_events.to_glib(), cursor.to_glib_none().0, event.to_glib_none().0, prepare_func, super_callback0 as *const _ as usize as *mut _))
--- a/src/auto/window.rs
+++ b/src/auto/window.rs
@@ -908,7 +908,7 @@ impl<O: IsA<Window>> WindowExt for O {
             };
             res.to_glib()
         }
-        let child_func = Some(child_func_func as _);
+        let child_func = if child_func_data.is_some() { Some(child_func_func as _) } else { None };
         let super_callback0: &Option<&mut dyn (FnMut(&Window) -> bool)> = &child_func_data;
         unsafe {
             gdk_sys::gdk_window_invalidate_maybe_recurse(self.as_ref().to_glib_none().0, region.to_glib_none().0, child_func, super_callback0 as *const _ as usize as *mut _);

@jangernert can you test this change just in case?

cc @GuillaumeGomez

@EPashkin EPashkin referenced this pull request Apr 14, 2019

Closed

gdk::Seat::grab() panic #287

@jangernert

This comment has been minimized.

Copy link

commented Apr 14, 2019

@EPashkin how would I test this?

@EPashkin

This comment has been minimized.

Copy link
Member Author

commented Apr 14, 2019

Clone gdk repo crate branch,
add changes to Seat::grab,
add Replace or Path to your local gdk copy to Cargo.toml in your project.

@GuillaumeGomez

This comment has been minimized.

Copy link
Member

commented Apr 14, 2019

Thanks! 👍

@sdroege

This comment has been minimized.

Copy link
Member

commented Apr 15, 2019

👍

Good that we didn't do a release yet, the callback fixes from before were apparently incomplete :)

@jangernert

This comment has been minimized.

Copy link

commented Apr 15, 2019

@EPashkin the patches only apply to master which then causes some dependency resolve problems when overwriting gdk with the patched master version.

edit:
adapted the first patch slightly for the crate branch. "Works for me"^TM

@EPashkin

This comment has been minimized.

Copy link
Member Author

commented Apr 15, 2019

@jangernert Thanks for checking

@EPashkin EPashkin merged commit 58cffd4 into gtk-rs:master Apr 15, 2019

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@EPashkin EPashkin deleted the EPashkin:nullable_scope_call branch Apr 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.