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

Remove callback guard #667

Merged
merged 3 commits into from Jun 23, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions check_init_asserts
Expand Up @@ -10,8 +10,7 @@ while (/^(\N*)\V*fn\s+(\w+)\s*(<[^(]+>)?\s*(\([^{;]+)\{\N*\n^(\N*)$/gms) {
$first_line =~ /^\s*(
assert_initialized_main_thread |
assert_not_initialized |
skip_assert_initialized |
callback_guard
skip_assert_initialized
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unsafe functions just not checked, so this line not worked anyway

)!\(\)/x) {
print "$ARGV: $name$signature\n";
$e = 1
Expand Down
2 changes: 1 addition & 1 deletion gir-files
2 changes: 0 additions & 2 deletions src/assistant.rs
Expand Up @@ -21,12 +21,10 @@ impl<O: IsA<Assistant>> AssistantExtManual for O {
}

unsafe extern "C" fn forward_page_trampoline(current_page: i32, f: glib_ffi::gpointer) -> i32 {
callback_guard!();
let f: &&(Fn(i32) -> i32 + 'static) = transmute(f);
f(current_page)
}

unsafe extern "C" fn destroy_closure(ptr: glib_ffi::gpointer) {
callback_guard!();
Box_::<Box_<Fn(i32) -> i32 + 'static>>::from_raw(ptr as *mut _);
}
16 changes: 0 additions & 16 deletions src/auto/about_dialog.rs
Expand Up @@ -481,112 +481,96 @@ impl<O: IsA<AboutDialog> + IsA<glib::object::Object>> AboutDialogExt for O {

unsafe extern "C" fn activate_link_trampoline<P>(this: *mut ffi::GtkAboutDialog, uri: *mut libc::c_char, f: glib_ffi::gpointer) -> glib_ffi::gboolean
where P: IsA<AboutDialog> {
callback_guard!();
let f: &&(Fn(&P, &str) -> Inhibit + 'static) = transmute(f);
f(&AboutDialog::from_glib_borrow(this).downcast_unchecked(), &String::from_glib_none(uri)).to_glib()
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

unsafe extern "C" fn notify_wrap_license_trampoline<P>(this: *mut ffi::GtkAboutDialog, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<AboutDialog> {
callback_guard!();
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&AboutDialog::from_glib_borrow(this).downcast_unchecked())
}
3 changes: 0 additions & 3 deletions src/auto/accel_group.rs
Expand Up @@ -158,21 +158,18 @@ impl<O: IsA<AccelGroup> + IsA<glib::object::Object>> AccelGroupExt for O {

unsafe extern "C" fn accel_activate_trampoline<P>(this: *mut ffi::GtkAccelGroup, acceleratable: *mut gobject_ffi::GObject, keyval: libc::c_uint, modifier: gdk_ffi::GdkModifierType, f: glib_ffi::gpointer) -> glib_ffi::gboolean
where P: IsA<AccelGroup> {
callback_guard!();
let f: &&(Fn(&P, &glib::Object, u32, gdk::ModifierType) -> bool + 'static) = transmute(f);
f(&AccelGroup::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(acceleratable), keyval, from_glib(modifier)).to_glib()
}

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

unsafe extern "C" fn notify_modifier_mask_trampoline<P>(this: *mut ffi::GtkAccelGroup, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<AccelGroup> {
callback_guard!();
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&AccelGroup::from_glib_borrow(this).downcast_unchecked())
}
1 change: 0 additions & 1 deletion src/auto/actionable.rs
Expand Up @@ -90,7 +90,6 @@ impl<O: IsA<Actionable> + IsA<glib::object::Object>> ActionableExt for O {

unsafe extern "C" fn notify_action_name_trampoline<P>(this: *mut ffi::GtkActionable, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Actionable> {
callback_guard!();
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Actionable::from_glib_borrow(this).downcast_unchecked())
}
8 changes: 0 additions & 8 deletions src/auto/adjustment.rs
Expand Up @@ -257,56 +257,48 @@ impl<O: IsA<Adjustment> + IsA<glib::object::Object>> AdjustmentExt for O {

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

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

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

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

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

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

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

unsafe extern "C" fn notify_value_trampoline<P>(this: *mut ffi::GtkAdjustment, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Adjustment> {
callback_guard!();
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Adjustment::from_glib_borrow(this).downcast_unchecked())
}
8 changes: 0 additions & 8 deletions src/auto/alignment.rs
Expand Up @@ -326,56 +326,48 @@ impl<O: IsA<Alignment> + IsA<glib::object::Object>> AlignmentExt for O {

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

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

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

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

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

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

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

unsafe extern "C" fn notify_yscale_trampoline<P>(this: *mut ffi::GtkAlignment, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Alignment> {
callback_guard!();
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Alignment::from_glib_borrow(this).downcast_unchecked())
}
4 changes: 0 additions & 4 deletions src/auto/app_chooser_button.rs
Expand Up @@ -161,28 +161,24 @@ impl<O: IsA<AppChooserButton> + IsA<glib::object::Object>> AppChooserButtonExt f

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

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

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

unsafe extern "C" fn notify_show_dialog_item_trampoline<P>(this: *mut ffi::GtkAppChooserButton, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<AppChooserButton> {
callback_guard!();
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&AppChooserButton::from_glib_borrow(this).downcast_unchecked())
}
2 changes: 0 additions & 2 deletions src/auto/app_chooser_dialog.rs
Expand Up @@ -115,14 +115,12 @@ impl<O: IsA<AppChooserDialog> + IsA<glib::object::Object>> AppChooserDialogExt f

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

unsafe extern "C" fn notify_heading_trampoline<P>(this: *mut ffi::GtkAppChooserDialog, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<AppChooserDialog> {
callback_guard!();
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&AppChooserDialog::from_glib_borrow(this).downcast_unchecked())
}
9 changes: 0 additions & 9 deletions src/auto/app_chooser_widget.rs
Expand Up @@ -234,63 +234,54 @@ impl<O: IsA<AppChooserWidget> + IsA<glib::object::Object>> AppChooserWidgetExt f

unsafe extern "C" fn application_activated_trampoline<P>(this: *mut ffi::GtkAppChooserWidget, application: *mut gio_ffi::GAppInfo, f: glib_ffi::gpointer)
where P: IsA<AppChooserWidget> {
callback_guard!();
let f: &&(Fn(&P, &gio::AppInfo) + 'static) = transmute(f);
f(&AppChooserWidget::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(application))
}

unsafe extern "C" fn application_selected_trampoline<P>(this: *mut ffi::GtkAppChooserWidget, application: *mut gio_ffi::GAppInfo, f: glib_ffi::gpointer)
where P: IsA<AppChooserWidget> {
callback_guard!();
let f: &&(Fn(&P, &gio::AppInfo) + 'static) = transmute(f);
f(&AppChooserWidget::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(application))
}

unsafe extern "C" fn populate_popup_trampoline<P>(this: *mut ffi::GtkAppChooserWidget, menu: *mut ffi::GtkMenu, application: *mut gio_ffi::GAppInfo, f: glib_ffi::gpointer)
where P: IsA<AppChooserWidget> {
callback_guard!();
let f: &&(Fn(&P, &Menu, &gio::AppInfo) + 'static) = transmute(f);
f(&AppChooserWidget::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(menu), &from_glib_borrow(application))
}

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

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

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

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

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

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