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

Commit 6cad551

Browse files
Merge pull request #90 from EPashkin/restore_callback_guard
Restore callback guard
2 parents a5a143e + d6ba245 commit 6cad551

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+725
-71
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ git = "https://github.com/gtk-rs/lgpl-docs"
3939
[dependencies]
4040
libc = "0.2"
4141
bitflags = "1.0"
42+
lazy_static = "1.0"
4243

4344
[dependencies.gio-sys]
4445
version = "0.5.0"

src/application.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ impl<O: IsA<Application> + IsA<glib::object::Object>> ApplicationExtManual for O
3636
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
3737
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)
3838
where P: IsA<Application> {
39+
callback_guard!();
3940
let f: &&(Fn(&P, &[File], &str) + 'static) = transmute(f);
4041
let files: Vec<File> = FromGlibContainer::from_glib_none_num(files, n_files as usize);
4142
f(&Application::from_glib_none(this).downcast_unchecked(), &files, &String::from_glib_none(hint))

src/auto/action.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file was generated by gir (https://github.com/gtk-rs/gir @ bd67955)
1+
// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4)
22
// from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70)
33
// DO NOT EDIT
44

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

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

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

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

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

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

src/auto/action_group.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file was generated by gir (https://github.com/gtk-rs/gir @ bd67955)
1+
// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4)
22
// from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70)
33
// DO NOT EDIT
44

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

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

184185
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)
185186
where P: IsA<ActionGroup> {
187+
callback_guard!();
186188
let f: &&(Fn(&P, &str, bool) + 'static) = transmute(f);
187189
f(&ActionGroup::from_glib_borrow(this).downcast_unchecked(), &String::from_glib_none(action_name), from_glib(enabled))
188190
}
189191

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

196199
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)
197200
where P: IsA<ActionGroup> {
201+
callback_guard!();
198202
let f: &&(Fn(&P, &str, &glib::Variant) + 'static) = transmute(f);
199203
f(&ActionGroup::from_glib_borrow(this).downcast_unchecked(), &String::from_glib_none(action_name), &from_glib_borrow(value))
200204
}

src/auto/action_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file was generated by gir (https://github.com/gtk-rs/gir @ bd67955)
1+
// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4)
22
// from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70)
33
// DO NOT EDIT
44

src/auto/app_info.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file was generated by gir (https://github.com/gtk-rs/gir @ bd67955)
1+
// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4)
22
// from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70)
33
// DO NOT EDIT
44

@@ -90,6 +90,7 @@ impl AppInfo {
9090
let user_data: Box<Box<Q>> = Box::new(Box::new(callback));
9191
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)
9292
{
93+
callback_guard!();
9394
let mut error = ptr::null_mut();
9495
let _ = ffi::g_app_info_launch_default_for_uri_finish(res, &mut error);
9596
let result = if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) };

src/auto/app_launch_context.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file was generated by gir (https://github.com/gtk-rs/gir @ bd67955)
1+
// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4)
22
// from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70)
33
// DO NOT EDIT
44

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

133134
#[cfg(any(feature = "v2_36", feature = "dox"))]
134135
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)
135136
where P: IsA<AppLaunchContext> {
137+
callback_guard!();
136138
let f: &&(Fn(&P, &AppInfo, &glib::Variant) + 'static) = transmute(f);
137139
f(&AppLaunchContext::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(info), &from_glib_borrow(platform_data))
138140
}

src/auto/application.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file was generated by gir (https://github.com/gtk-rs/gir @ bd67955)
1+
// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4)
22
// from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70)
33
// DO NOT EDIT
44

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

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

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

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

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

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

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

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

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

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

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

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

src/auto/buffered_input_stream.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file was generated by gir (https://github.com/gtk-rs/gir @ bd67955)
1+
// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4)
22
// from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70)
33
// DO NOT EDIT
44

@@ -78,6 +78,7 @@ impl<O: IsA<BufferedInputStream> + IsA<glib::object::Object>> BufferedInputStrea
7878
let user_data: Box<Box<Q>> = Box::new(Box::new(callback));
7979
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)
8080
{
81+
callback_guard!();
8182
let mut error = ptr::null_mut();
8283
let ret = ffi::g_buffered_input_stream_fill_finish(_source_object as *mut _, res, &mut error);
8384
let result = if error.is_null() { Ok(ret) } else { Err(from_glib_full(error)) };
@@ -137,6 +138,7 @@ impl<O: IsA<BufferedInputStream> + IsA<glib::object::Object>> BufferedInputStrea
137138

138139
unsafe extern "C" fn notify_buffer_size_trampoline<P>(this: *mut ffi::GBufferedInputStream, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
139140
where P: IsA<BufferedInputStream> {
141+
callback_guard!();
140142
let f: &&(Fn(&P) + 'static) = transmute(f);
141143
f(&BufferedInputStream::from_glib_borrow(this).downcast_unchecked())
142144
}

src/auto/buffered_output_stream.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file was generated by gir (https://github.com/gtk-rs/gir @ bd67955)
1+
// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4)
22
// from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70)
33
// DO NOT EDIT
44

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

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

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

src/auto/cancellable.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file was generated by gir (https://github.com/gtk-rs/gir @ bd67955)
1+
// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4)
22
// from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70)
33
// DO NOT EDIT
44

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

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

0 commit comments

Comments
 (0)