Skip to content
This repository was archived by the owner on Jun 8, 2021. It is now read-only.

Restore callback guard #90

Merged
merged 2 commits into from
Mar 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ git = "https://github.com/gtk-rs/lgpl-docs"
[dependencies]
libc = "0.2"
bitflags = "1.0"
lazy_static = "1.0"

[dependencies.gio-sys]
version = "0.5.0"
Expand Down
1 change: 1 addition & 0 deletions src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ impl<O: IsA<Application> + IsA<glib::object::Object>> ApplicationExtManual for O
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
unsafe extern "C" fn open_trampoline<P>(this: *mut ffi::GApplication, files: *const *mut ffi::GFile, n_files: libc::c_int, hint: *mut libc::c_char, f: glib_ffi::gpointer)
where P: IsA<Application> {
callback_guard!();
let f: &&(Fn(&P, &[File], &str) + 'static) = transmute(f);
let files: Vec<File> = FromGlibContainer::from_glib_none_num(files, n_files as usize);
f(&Application::from_glib_none(this).downcast_unchecked(), &files, &String::from_glib_none(hint))
Expand Down
7 changes: 6 additions & 1 deletion src/auto/action.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ bd67955)
// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4)
// from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70)
// DO NOT EDIT

Expand Down Expand Up @@ -177,30 +177,35 @@ impl<O: IsA<Action> + IsA<glib::object::Object>> ActionExt for O {

unsafe extern "C" fn notify_enabled_trampoline<P>(this: *mut ffi::GAction, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Action> {
callback_guard!();
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Action::from_glib_borrow(this).downcast_unchecked())
}

unsafe extern "C" fn notify_name_trampoline<P>(this: *mut ffi::GAction, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Action> {
callback_guard!();
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Action::from_glib_borrow(this).downcast_unchecked())
}

unsafe extern "C" fn notify_parameter_type_trampoline<P>(this: *mut ffi::GAction, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Action> {
callback_guard!();
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Action::from_glib_borrow(this).downcast_unchecked())
}

unsafe extern "C" fn notify_state_trampoline<P>(this: *mut ffi::GAction, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Action> {
callback_guard!();
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Action::from_glib_borrow(this).downcast_unchecked())
}

unsafe extern "C" fn notify_state_type_trampoline<P>(this: *mut ffi::GAction, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Action> {
callback_guard!();
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Action::from_glib_borrow(this).downcast_unchecked())
}
6 changes: 5 additions & 1 deletion src/auto/action_group.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ bd67955)
// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4)
// from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70)
// DO NOT EDIT

Expand Down Expand Up @@ -177,24 +177,28 @@ impl<O: IsA<ActionGroup> + IsA<glib::object::Object>> ActionGroupExt for O {

unsafe extern "C" fn action_added_trampoline<P>(this: *mut ffi::GActionGroup, action_name: *mut libc::c_char, f: glib_ffi::gpointer)
where P: IsA<ActionGroup> {
callback_guard!();
let f: &&(Fn(&P, &str) + 'static) = transmute(f);
f(&ActionGroup::from_glib_borrow(this).downcast_unchecked(), &String::from_glib_none(action_name))
}

unsafe extern "C" fn action_enabled_changed_trampoline<P>(this: *mut ffi::GActionGroup, action_name: *mut libc::c_char, enabled: glib_ffi::gboolean, f: glib_ffi::gpointer)
where P: IsA<ActionGroup> {
callback_guard!();
let f: &&(Fn(&P, &str, bool) + 'static) = transmute(f);
f(&ActionGroup::from_glib_borrow(this).downcast_unchecked(), &String::from_glib_none(action_name), from_glib(enabled))
}

unsafe extern "C" fn action_removed_trampoline<P>(this: *mut ffi::GActionGroup, action_name: *mut libc::c_char, f: glib_ffi::gpointer)
where P: IsA<ActionGroup> {
callback_guard!();
let f: &&(Fn(&P, &str) + 'static) = transmute(f);
f(&ActionGroup::from_glib_borrow(this).downcast_unchecked(), &String::from_glib_none(action_name))
}

unsafe extern "C" fn action_state_changed_trampoline<P>(this: *mut ffi::GActionGroup, action_name: *mut libc::c_char, value: *mut glib_ffi::GVariant, f: glib_ffi::gpointer)
where P: IsA<ActionGroup> {
callback_guard!();
let f: &&(Fn(&P, &str, &glib::Variant) + 'static) = transmute(f);
f(&ActionGroup::from_glib_borrow(this).downcast_unchecked(), &String::from_glib_none(action_name), &from_glib_borrow(value))
}
2 changes: 1 addition & 1 deletion src/auto/action_map.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ bd67955)
// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4)
// from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70)
// DO NOT EDIT

Expand Down
3 changes: 2 additions & 1 deletion src/auto/app_info.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ bd67955)
// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4)
// from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70)
// DO NOT EDIT

Expand Down Expand Up @@ -90,6 +90,7 @@ impl AppInfo {
let user_data: Box<Box<Q>> = Box::new(Box::new(callback));
unsafe extern "C" fn launch_default_for_uri_async_trampoline<Q: FnOnce(Result<(), Error>) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut ffi::GAsyncResult, user_data: glib_ffi::gpointer)
{
callback_guard!();
let mut error = ptr::null_mut();
let _ = ffi::g_app_info_launch_default_for_uri_finish(res, &mut error);
let result = if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) };
Expand Down
4 changes: 3 additions & 1 deletion src/auto/app_launch_context.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ bd67955)
// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4)
// from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70)
// DO NOT EDIT

Expand Down Expand Up @@ -126,13 +126,15 @@ impl<O: IsA<AppLaunchContext> + IsA<glib::object::Object>> AppLaunchContextExt f
#[cfg(any(feature = "v2_36", feature = "dox"))]
unsafe extern "C" fn launch_failed_trampoline<P>(this: *mut ffi::GAppLaunchContext, startup_notify_id: *mut libc::c_char, f: glib_ffi::gpointer)
where P: IsA<AppLaunchContext> {
callback_guard!();
let f: &&(Fn(&P, &str) + 'static) = transmute(f);
f(&AppLaunchContext::from_glib_borrow(this).downcast_unchecked(), &String::from_glib_none(startup_notify_id))
}

#[cfg(any(feature = "v2_36", feature = "dox"))]
unsafe extern "C" fn launched_trampoline<P>(this: *mut ffi::GAppLaunchContext, info: *mut ffi::GAppInfo, platform_data: *mut glib_ffi::GVariant, f: glib_ffi::gpointer)
where P: IsA<AppLaunchContext> {
callback_guard!();
let f: &&(Fn(&P, &AppInfo, &glib::Variant) + 'static) = transmute(f);
f(&AppLaunchContext::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(info), &from_glib_borrow(platform_data))
}
13 changes: 12 additions & 1 deletion src/auto/application.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ bd67955)
// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4)
// from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70)
// DO NOT EDIT

Expand Down Expand Up @@ -480,67 +480,78 @@ impl<O: IsA<Application> + IsA<glib::object::Object>> ApplicationExt for O {

unsafe extern "C" fn activate_trampoline<P>(this: *mut ffi::GApplication, f: glib_ffi::gpointer)
where P: IsA<Application> {
callback_guard!();
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Application::from_glib_borrow(this).downcast_unchecked())
}

unsafe extern "C" fn shutdown_trampoline<P>(this: *mut ffi::GApplication, f: glib_ffi::gpointer)
where P: IsA<Application> {
callback_guard!();
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Application::from_glib_borrow(this).downcast_unchecked())
}

unsafe extern "C" fn startup_trampoline<P>(this: *mut ffi::GApplication, f: glib_ffi::gpointer)
where P: IsA<Application> {
callback_guard!();
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Application::from_glib_borrow(this).downcast_unchecked())
}

unsafe extern "C" fn notify_action_group_trampoline<P>(this: *mut ffi::GApplication, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Application> {
callback_guard!();
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Application::from_glib_borrow(this).downcast_unchecked())
}

unsafe extern "C" fn notify_application_id_trampoline<P>(this: *mut ffi::GApplication, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Application> {
callback_guard!();
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Application::from_glib_borrow(this).downcast_unchecked())
}

unsafe extern "C" fn notify_flags_trampoline<P>(this: *mut ffi::GApplication, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Application> {
callback_guard!();
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Application::from_glib_borrow(this).downcast_unchecked())
}

unsafe extern "C" fn notify_inactivity_timeout_trampoline<P>(this: *mut ffi::GApplication, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Application> {
callback_guard!();
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Application::from_glib_borrow(this).downcast_unchecked())
}

#[cfg(any(feature = "v2_44", feature = "dox"))]
unsafe extern "C" fn notify_is_busy_trampoline<P>(this: *mut ffi::GApplication, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Application> {
callback_guard!();
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Application::from_glib_borrow(this).downcast_unchecked())
}

unsafe extern "C" fn notify_is_registered_trampoline<P>(this: *mut ffi::GApplication, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Application> {
callback_guard!();
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Application::from_glib_borrow(this).downcast_unchecked())
}

unsafe extern "C" fn notify_is_remote_trampoline<P>(this: *mut ffi::GApplication, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Application> {
callback_guard!();
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Application::from_glib_borrow(this).downcast_unchecked())
}

unsafe extern "C" fn notify_resource_base_path_trampoline<P>(this: *mut ffi::GApplication, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Application> {
callback_guard!();
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Application::from_glib_borrow(this).downcast_unchecked())
}
4 changes: 3 additions & 1 deletion src/auto/buffered_input_stream.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ bd67955)
// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4)
// from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70)
// DO NOT EDIT

Expand Down Expand Up @@ -78,6 +78,7 @@ impl<O: IsA<BufferedInputStream> + IsA<glib::object::Object>> BufferedInputStrea
let user_data: Box<Box<Q>> = Box::new(Box::new(callback));
unsafe extern "C" fn fill_async_trampoline<Q: FnOnce(Result<isize, Error>) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut ffi::GAsyncResult, user_data: glib_ffi::gpointer)
{
callback_guard!();
let mut error = ptr::null_mut();
let ret = ffi::g_buffered_input_stream_fill_finish(_source_object as *mut _, res, &mut error);
let result = if error.is_null() { Ok(ret) } else { Err(from_glib_full(error)) };
Expand Down Expand Up @@ -137,6 +138,7 @@ impl<O: IsA<BufferedInputStream> + IsA<glib::object::Object>> BufferedInputStrea

unsafe extern "C" fn notify_buffer_size_trampoline<P>(this: *mut ffi::GBufferedInputStream, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<BufferedInputStream> {
callback_guard!();
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&BufferedInputStream::from_glib_borrow(this).downcast_unchecked())
}
4 changes: 3 additions & 1 deletion src/auto/buffered_output_stream.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ bd67955)
// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4)
// from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70)
// DO NOT EDIT

Expand Down Expand Up @@ -99,12 +99,14 @@ impl<O: IsA<BufferedOutputStream> + IsA<glib::object::Object>> BufferedOutputStr

unsafe extern "C" fn notify_auto_grow_trampoline<P>(this: *mut ffi::GBufferedOutputStream, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<BufferedOutputStream> {
callback_guard!();
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&BufferedOutputStream::from_glib_borrow(this).downcast_unchecked())
}

unsafe extern "C" fn notify_buffer_size_trampoline<P>(this: *mut ffi::GBufferedOutputStream, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<BufferedOutputStream> {
callback_guard!();
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&BufferedOutputStream::from_glib_borrow(this).downcast_unchecked())
}
3 changes: 2 additions & 1 deletion src/auto/cancellable.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ bd67955)
// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4)
// from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70)
// DO NOT EDIT

Expand Down Expand Up @@ -156,6 +156,7 @@ impl<O: IsA<Cancellable> + IsA<glib::object::Object>> CancellableExt for O {

unsafe extern "C" fn cancelled_trampoline<P>(this: *mut ffi::GCancellable, f: glib_ffi::gpointer)
where P: IsA<Cancellable> {
callback_guard!();
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Cancellable::from_glib_borrow(this).downcast_unchecked())
}
Loading