From 79e84f5fe69e73e88c7fc7e8dff13b334cda8b55 Mon Sep 17 00:00:00 2001 From: Evgenii Pashkin Date: Fri, 2 Mar 2018 19:31:12 +0300 Subject: [PATCH] Revert "Remove adding callback_guard" This reverts commit a61ccc16be2e0add02ec7b7953f55ee04317cbf5. --- src/codegen/function_body_chunk.rs | 6 +++++- src/codegen/trampoline.rs | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/codegen/function_body_chunk.rs b/src/codegen/function_body_chunk.rs index 36aee750a..442d83dff 100644 --- a/src/codegen/function_body_chunk.rs +++ b/src/codegen/function_body_chunk.rs @@ -242,11 +242,15 @@ impl Builder { Param { name: "res".to_string(), typ: format!("*mut {}::GAsyncResult", gio_crate_name) }, Param { name: "user_data".to_string(), typ: format!("{}::gpointer", glib_crate_name) }, ]; + let body = Chunk::Chunks(vec![ + Chunk::Custom("callback_guard!();".into()), + Chunk::Chunks(body), + ]); chunks.push(Chunk::ExternCFunc { name: format!("{}<{}: {}>", trampoline.name, trampoline.bound_name, trampoline.callback_type), parameters, - body: Box::new(Chunk::Chunks(body)), + body: Box::new(body), }); let chunk = Chunk::Let { name: "callback".to_string(), diff --git a/src/codegen/trampoline.rs b/src/codegen/trampoline.rs index 743399427..ed22a4523 100644 --- a/src/codegen/trampoline.rs +++ b/src/codegen/trampoline.rs @@ -51,6 +51,7 @@ pub fn generate( object_name )); } + try!(writeln!(w, "\tcallback_guard!();")); try!(writeln!(w, "\tlet f: &&({}) = transmute(f);", func_str)); try!(transformation_vars(w, analysis)); let call = trampoline_call_func(env, analysis, in_trait);