diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2017-03-22 16:04:00 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2017-03-22 16:08:37 +0100 |
commit | db6f68f365a168f1fcc8f46e4f7674acd84e2266 (patch) | |
tree | 76be9d581ec04191ec0d9aefd321f5c08bbabeac /codegen | |
parent | 46a1225768849c3d255c247e93b3e705f991baf7 (diff) | |
download | vala-db6f68f365a168f1fcc8f46e4f7674acd84e2266.tar.gz |
codegen: Fix delegate initializer for instance fields
Set delegate-target to "self" which is available in *_instance_init().
https://bugzilla.gnome.org/show_bug.cgi?id=683925
Diffstat (limited to 'codegen')
-rw-r--r-- | codegen/valaccodebasemodule.vala | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala index 2d3ae5eb6..8a95c6431 100644 --- a/codegen/valaccodebasemodule.vala +++ b/codegen/valaccodebasemodule.vala @@ -1130,6 +1130,16 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator { var rhs_array_len = get_array_length_cvalue (field_value, 1); ccode.add_assignment (lhs_array_size, rhs_array_len); } + } else if (f.variable_type is DelegateType) { + var delegate_type = (DelegateType) f.variable_type; + if (delegate_type.delegate_symbol.has_target) { + var field_value = get_field_cvalue (f, load_this_parameter ((TypeSymbol) f.parent_symbol)); + + ccode.add_assignment (get_delegate_target_cvalue (field_value), new CCodeIdentifier ("self")); + if (delegate_type.is_disposable ()) { + ccode.add_assignment (get_delegate_target_destroy_notify_cvalue (field_value), new CCodeIdentifier ("NULL")); + } + } } } |