Commit 8054d88b authored by Rico Tzschichholz's avatar Rico Tzschichholz

codegen: Rely on get_ccode_delegate_target() for delegate variables only

parent b9e13e39
......@@ -212,7 +212,7 @@ public class Vala.CCodeAssignmentModule : CCodeMemberAccessModule {
if (lvalue.actual_value_type != null) {
type = lvalue.actual_value_type;
}
if (get_ccode_delegate_target (field) && requires_destroy (type)) {
if ((!(field.variable_type is DelegateType) || get_ccode_delegate_target (field)) && requires_destroy (type)) {
/* unref old value */
ccode.add_expression (destroy_field (field, instance));
}
......
......@@ -1211,7 +1211,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
pop_context ();
}
if (get_ccode_delegate_target (f) && requires_destroy (f.variable_type) && instance_finalize_context != null) {
if ((!(f.variable_type is DelegateType) || get_ccode_delegate_target (f)) && requires_destroy (f.variable_type) && instance_finalize_context != null) {
push_context (instance_finalize_context);
ccode.add_expression (destroy_field (f, load_this_parameter ((TypeSymbol) f.parent_symbol)));
pop_context ();
......@@ -6505,7 +6505,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
var this_value = load_this_parameter (st);
foreach (Field f in st.get_fields ()) {
if (f.binding == MemberBinding.INSTANCE) {
if (get_ccode_delegate_target (f) && requires_destroy (f.variable_type)) {
if ((!(f.variable_type is DelegateType) || get_ccode_delegate_target (f)) && requires_destroy (f.variable_type)) {
ccode.add_expression (destroy_field (f, this_value));
}
}
......@@ -6536,7 +6536,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
foreach (Field f in st.get_fields ()) {
if (f.binding == MemberBinding.INSTANCE) {
var value = load_field (f, load_this_parameter ((TypeSymbol) st));
if (get_ccode_delegate_target (f) && requires_copy (f.variable_type)) {
if ((!(f.variable_type is DelegateType) || get_ccode_delegate_target (f)) && requires_copy (f.variable_type)) {
value = copy_value (value, f);
if (value == null) {
// error case, continue to avoid critical
......
......@@ -311,7 +311,7 @@ public abstract class Vala.CCodeStructModule : CCodeBaseModule {
foreach (var f in st.get_fields ()) {
if (f.binding == MemberBinding.INSTANCE) {
var value = load_field (f, load_this_parameter ((TypeSymbol) st));
if (get_ccode_delegate_target (f) && requires_copy (f.variable_type)) {
if ((!(f.variable_type is DelegateType) || get_ccode_delegate_target (f)) && requires_copy (f.variable_type)) {
value = copy_value (value, f);
if (value == null) {
// error case, continue to avoid critical
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment