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

Revert "Remove callback_guard" #67

Merged
merged 1 commit 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
2 changes: 1 addition & 1 deletion src/auto/enums.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 @ 8b9d0bb)
// 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
2 changes: 1 addition & 1 deletion src/auto/flags.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 @ 8b9d0bb)
// 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
2 changes: 1 addition & 1 deletion src/auto/mod.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 @ 8b9d0bb)
// 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
11 changes: 10 additions & 1 deletion src/auto/pixbuf.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 @ 8b9d0bb)
// 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 @@ -513,54 +513,63 @@ impl<O: IsA<Pixbuf> + IsA<glib::object::Object>> PixbufExt for O {

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

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

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

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

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

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

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

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

unsafe extern "C" fn notify_width_trampoline<P>(this: *mut ffi::GdkPixbuf, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Pixbuf> {
callback_guard!();
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Pixbuf::from_glib_borrow(this).downcast_unchecked())
}
2 changes: 1 addition & 1 deletion src/auto/pixbuf_format.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 @ 8b9d0bb)
// 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
6 changes: 5 additions & 1 deletion src/auto/pixbuf_loader.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 @ 8b9d0bb)
// 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 @@ -170,24 +170,28 @@ impl<O: IsA<PixbufLoader> + IsA<glib::object::Object>> PixbufLoaderExt for O {

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

unsafe extern "C" fn area_updated_trampoline<P>(this: *mut ffi::GdkPixbufLoader, x: libc::c_int, y: libc::c_int, width: libc::c_int, height: libc::c_int, f: glib_ffi::gpointer)
where P: IsA<PixbufLoader> {
callback_guard!();
let f: &&(Fn(&P, i32, i32, i32, i32) + 'static) = transmute(f);
f(&PixbufLoader::from_glib_borrow(this).downcast_unchecked(), x, y, width, height)
}

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

unsafe extern "C" fn size_prepared_trampoline<P>(this: *mut ffi::GdkPixbufLoader, width: libc::c_int, height: libc::c_int, f: glib_ffi::gpointer)
where P: IsA<PixbufLoader> {
callback_guard!();
let f: &&(Fn(&P, i32, i32) + 'static) = transmute(f);
f(&PixbufLoader::from_glib_borrow(this).downcast_unchecked(), width, height)
}
3 changes: 2 additions & 1 deletion src/auto/pixbuf_simple_anim.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 @ 8b9d0bb)
// 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 @@ -74,6 +74,7 @@ impl<O: IsA<PixbufSimpleAnim> + IsA<glib::object::Object>> PixbufSimpleAnimExt f

unsafe extern "C" fn notify_loop_trampoline<P>(this: *mut ffi::GdkPixbufSimpleAnim, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<PixbufSimpleAnim> {
callback_guard!();
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&PixbufSimpleAnim::from_glib_borrow(this).downcast_unchecked())
}
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ pub use glib::{
Value,
};

#[macro_use]
mod rt;

mod auto;

mod animation;
Expand Down
3 changes: 3 additions & 0 deletions src/pixbuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ impl Pixbuf {
let user_data: Box<Box<R>> = Box::new(Box::new(callback));
unsafe extern "C" fn new_from_stream_async_trampoline<R: FnOnce(Result<Pixbuf, Error>) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer)
{
callback_guard!();
let mut error = ptr::null_mut();
let ptr = ffi::gdk_pixbuf_new_from_stream_finish(res, &mut error);
let result = if error.is_null() {
Expand All @@ -126,6 +127,7 @@ impl Pixbuf {
let user_data: Box<Box<R>> = Box::new(Box::new(callback));
unsafe extern "C" fn new_from_stream_at_scale_async_trampoline<R: FnOnce(Result<Pixbuf, Error>) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer)
{
callback_guard!();
let mut error = ptr::null_mut();
let ptr = ffi::gdk_pixbuf_new_from_stream_finish(res, &mut error);
let result = if error.is_null() {
Expand Down Expand Up @@ -185,6 +187,7 @@ impl Pixbuf {
let user_data: Box<Box<Q>> = Box::new(Box::new(callback));
unsafe extern "C" fn get_file_info_async_trampoline<Q: FnOnce(Result<Option<(PixbufFormat, i32, i32)>, Error>) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer)
{
callback_guard!();
let mut error = ptr::null_mut();
let mut width = mem::uninitialized();
let mut height = mem::uninitialized();
Expand Down
17 changes: 17 additions & 0 deletions src/rt.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright 2013-2017, The Gtk-rs Project Developers.
// See the COPYRIGHT file at the top-level directory of this distribution.
// Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT>


macro_rules! assert_initialized_main_thread {
() => ()
}

macro_rules! callback_guard {
() => (
let _guard = ::glib::CallbackGuard::new();
if cfg!(debug_assertions) {
assert_initialized_main_thread!();
}
)
}