[vala] Support delegates with owned delegate return types
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] Support delegates with owned delegate return types
- Date: Sun, 19 Dec 2010 14:36:17 +0000 (UTC)
commit e2b4fe06ebfc51bd561e2efcccfb85f2dac14a19
Author: Luca Bruno <lucabru src gnome org>
Date: Sat Dec 18 11:54:43 2010 +0100
Support delegates with owned delegate return types
Fixes bug 633839.
codegen/valaccodedelegatemodule.vala | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valaccodedelegatemodule.vala b/codegen/valaccodedelegatemodule.vala
index 12ecb63..5e978f0 100644
--- a/codegen/valaccodedelegatemodule.vala
+++ b/codegen/valaccodedelegatemodule.vala
@@ -91,6 +91,10 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
if (result_d.has_target) {
var cparam = new CCodeParameter (get_delegate_target_cname ("result"), "void**");
cfundecl.add_parameter (cparam);
+ if (deleg_type.value_owned) {
+ cparam = new CCodeParameter (get_delegate_target_destroy_notify_cname ("result"), "GDestroyNotify*");
+ cfundecl.add_parameter (cparam);
+ }
}
} else if (d.return_type.is_real_non_null_struct_type ()) {
var cparam = new CCodeParameter ("result", "%s*".printf (d.return_type.get_cname ()));
@@ -234,6 +238,10 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
if (deleg_type.delegate_symbol.has_target) {
var cparam = new CCodeParameter (get_delegate_target_cname ("result"), "void**");
cparam_map.set (get_param_pos (d.cdelegate_target_parameter_position), cparam);
+ if (deleg_type.value_owned) {
+ cparam = new CCodeParameter (get_delegate_target_destroy_notify_cname ("result"), "GDestroyNotify*");
+ cparam_map.set (get_param_pos (d.cdelegate_target_parameter_position + 0.01), cparam);
+ }
}
} else if (d.return_type.is_real_non_null_struct_type ()) {
var cparam = new CCodeParameter ("result", "%s*".printf (d.return_type.get_cname ()));
@@ -345,6 +353,10 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
if (deleg_type.delegate_symbol.has_target) {
var ctarget = new CCodeIdentifier (get_delegate_target_cname ("result"));
carg_map.set (get_param_pos (m.cdelegate_target_parameter_position), ctarget);
+ if (deleg_type.value_owned) {
+ var ctarget_destroy_notify = new CCodeIdentifier (get_delegate_target_destroy_notify_cname ("result"));
+ carg_map.set (get_param_pos (m.cdelegate_target_parameter_position + 0.01), ctarget_destroy_notify);
+ }
}
} else if (m.return_type.is_real_non_null_struct_type ()) {
carg_map.set (get_param_pos (-3), new CCodeIdentifier ("result"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]