]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Rely on get_ccode_delegate_target() for delegate variables only
authorRico Tzschichholz <ricotz@ubuntu.com>
Mon, 14 Jan 2019 15:40:42 +0000 (16:40 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 14 Jan 2019 15:44:55 +0000 (16:44 +0100)
codegen/valaccodeassignmentmodule.vala
codegen/valaccodebasemodule.vala
codegen/valaccodestructmodule.vala

index ba5dd572a28689e9b3042730c8bbfbfbbda23ad4..96a47524eb9358277e1ef35f98d7620bc8c0c697 100644 (file)
@@ -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));
                }
index 192ce92bf353246794f75ff97f90120606c969cf..e6087db70ffe0afb0a5703cb7c182583873a26cf 100644 (file)
@@ -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
index 980fde023b8b6c892632964d165a222c84f5e667..e91762fb1dab541dbad8677e51f431c7c806b9a5 100644 (file)
@@ -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