@@ -54,20 +54,24 @@ impl ToGlib for Continue {
54
54
55
55
/// Unwinding propagation guard. Aborts the process if destroyed while
56
56
/// panicking.
57
+ #[ deprecated( note="Rustc 1.24.0 has this functionality buildin" ) ]
57
58
pub struct CallbackGuard ( ( ) ) ;
58
59
60
+ #[ allow( deprecated) ]
59
61
impl CallbackGuard {
60
62
pub fn new ( ) -> CallbackGuard {
61
63
CallbackGuard ( ( ) )
62
64
}
63
65
}
64
66
67
+ #[ allow( deprecated) ]
65
68
impl Default for CallbackGuard {
66
69
fn default ( ) -> Self {
67
70
Self :: new ( )
68
71
}
69
72
}
70
73
74
+ #[ allow( deprecated) ]
71
75
impl Drop for CallbackGuard {
72
76
fn drop ( & mut self ) {
73
77
use std:: io:: stderr;
@@ -82,13 +86,11 @@ impl Drop for CallbackGuard {
82
86
83
87
#[ cfg_attr( feature = "cargo-clippy" , allow( transmute_ptr_to_ref) ) ]
84
88
unsafe extern "C" fn trampoline ( func : gpointer ) -> gboolean {
85
- let _guard = CallbackGuard :: new ( ) ;
86
89
let func: & RefCell < Box < FnMut ( ) -> Continue + ' static > > = transmute ( func) ;
87
90
( & mut * func. borrow_mut ( ) ) ( ) . to_glib ( )
88
91
}
89
92
90
93
unsafe extern "C" fn destroy_closure ( ptr : gpointer ) {
91
- let _guard = CallbackGuard :: new ( ) ;
92
94
Box :: < RefCell < Box < FnMut ( ) -> Continue + ' static > > > :: from_raw ( ptr as * mut _ ) ;
93
95
}
94
96
@@ -100,13 +102,11 @@ fn into_raw<F: FnMut() -> Continue + Send + 'static>(func: F) -> gpointer {
100
102
101
103
#[ cfg_attr( feature = "cargo-clippy" , allow( transmute_ptr_to_ref) ) ]
102
104
unsafe extern "C" fn trampoline_child_watch ( pid : u32 , status : i32 , func : gpointer ) {
103
- let _guard = CallbackGuard :: new ( ) ;
104
105
let func: & RefCell < Box < FnMut ( u32 , i32 ) + ' static > > = transmute ( func) ;
105
106
( & mut * func. borrow_mut ( ) ) ( pid, status)
106
107
}
107
108
108
109
unsafe extern "C" fn destroy_closure_child_watch ( ptr : gpointer ) {
109
- let _guard = CallbackGuard :: new ( ) ;
110
110
Box :: < RefCell < Box < FnMut ( u32 , i32 ) + ' static > > > :: from_raw ( ptr as * mut _ ) ;
111
111
}
112
112
0 commit comments