[vala] Fix leak when calling methods with unowned delegate parameters



commit 9dc52c1a97cf872e1c4d9c0730d3dd7b3b3a2e46
Author: Jürg Billeter <j bitron ch>
Date:   Tue Sep 22 08:57:37 2009 +0200

    Fix leak when calling methods with unowned delegate parameters
    
    Fixes bug 595879.

 codegen/valaccodedelegatemodule.vala |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valaccodedelegatemodule.vala b/codegen/valaccodedelegatemodule.vala
index eb91e2d..52e0fc6 100644
--- a/codegen/valaccodedelegatemodule.vala
+++ b/codegen/valaccodedelegatemodule.vala
@@ -292,7 +292,7 @@ internal class Vala.CCodeDelegateModule : CCodeArrayModule {
 					return new CCodeIdentifier ("data");
 				} else {
 					var delegate_target = (CCodeExpression) get_ccodenode (ma.inner);
-					if (ma.inner.value_type.data_type != null && ma.inner.value_type.data_type.is_reference_counting ()) {
+					if (expr_owned && ma.inner.value_type.data_type != null && ma.inner.value_type.data_type.is_reference_counting ()) {
 						var ref_call = new CCodeFunctionCall (get_dup_func_expression (ma.inner.value_type, delegate_expr.source_reference));
 						ref_call.add_argument (delegate_target);
 						delegate_target = ref_call;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]