From: Jürg Billeter Date: Sun, 21 Mar 2010 19:02:25 +0000 (+0100) Subject: Fix implicit GValue conversion from owned values X-Git-Tag: 0.8.0~99 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=46e22cd13bfab93ab50ac02d2636e3b8712ce0c5;p=thirdparty%2Fvala.git Fix implicit GValue conversion from owned values --- diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala index d25ba871e..a6f2701ae 100644 --- a/codegen/valaccodebasemodule.vala +++ b/codegen/valaccodebasemodule.vala @@ -4860,7 +4860,7 @@ internal class Vala.CCodeBaseModule : CCodeModule { && expression_type.get_type_id () != "G_TYPE_VALUE"); if (expression_type.value_owned - && (target_type == null || !target_type.value_owned || boxing || unboxing || gvalue_boxing)) { + && (target_type == null || !target_type.value_owned || boxing || unboxing)) { // value leaked, destroy it var pointer_type = target_type as PointerType; if (pointer_type != null && !(pointer_type.base_type is VoidType)) { @@ -4930,7 +4930,11 @@ internal class Vala.CCodeBaseModule : CCodeModule { ccall.add_argument (new CCodeIdentifier (expression_type.get_type_id ())); ccomma.append_expression (ccall); - ccall = new CCodeFunctionCall (get_value_setter_function (expression_type)); + if (expression_type.value_owned) { + ccall = new CCodeFunctionCall (get_value_taker_function (expression_type)); + } else { + ccall = new CCodeFunctionCall (get_value_setter_function (expression_type)); + } if (target_type.nullable) { ccall.add_argument (get_variable_cexpression (decl.name)); } else {