summaryrefslogtreecommitdiff
path: root/codegen
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2019-01-14 16:40:42 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2019-01-14 16:44:55 +0100
commit8054d88bef9916c9c95cb641e7d5a0b1baf108e0 (patch)
tree85a285cd07884acebfded153e62a44bf962e4b54 /codegen
parentb9e13e39d9ebef287ae511d8f6f320752c1c55d7 (diff)
downloadvala-8054d88bef9916c9c95cb641e7d5a0b1baf108e0.tar.gz
codegen: Rely on get_ccode_delegate_target() for delegate variables only
Diffstat (limited to 'codegen')
-rw-r--r--codegen/valaccodeassignmentmodule.vala2
-rw-r--r--codegen/valaccodebasemodule.vala6
-rw-r--r--codegen/valaccodestructmodule.vala2
3 files changed, 5 insertions, 5 deletions
diff --git a/codegen/valaccodeassignmentmodule.vala b/codegen/valaccodeassignmentmodule.vala
index ba5dd572a..96a47524e 100644
--- a/codegen/valaccodeassignmentmodule.vala
+++ b/codegen/valaccodeassignmentmodule.vala
@@ -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));
}
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 192ce92bf..e6087db70 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -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
diff --git a/codegen/valaccodestructmodule.vala b/codegen/valaccodestructmodule.vala
index 980fde023..e91762fb1 100644
--- a/codegen/valaccodestructmodule.vala
+++ b/codegen/valaccodestructmodule.vala
@@ -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