[vala] Never try to use GValue take functions for primitive types



commit d2c5dd953627edc36233515dbacf2a67baef5f4b
Author: Jürg Billeter <j bitron ch>
Date:   Fri Mar 26 08:59:49 2010 +0100

    Never try to use GValue take functions for primitive types

 codegen/valaccodebasemodule.vala |    2 +-
 tests/structs/gvalue.vala        |    8 ++++++++
 2 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index f839654..01e5fa6 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -4991,7 +4991,7 @@ internal class Vala.CCodeBaseModule : CCodeModule {
 			ccall.add_argument (new CCodeIdentifier (expression_type.get_type_id ()));
 			ccomma.append_expression (ccall);
 
-			if (expression_type.value_owned) {
+			if (requires_destroy (expression_type)) {
 				ccall = new CCodeFunctionCall (get_value_taker_function (expression_type));
 			} else {
 				ccall = new CCodeFunctionCall (get_value_setter_function (expression_type));
diff --git a/tests/structs/gvalue.vala b/tests/structs/gvalue.vala
index 132af3d..c17c9d9 100644
--- a/tests/structs/gvalue.vala
+++ b/tests/structs/gvalue.vala
@@ -48,9 +48,17 @@ void test_nullable_value_array () {
 	}
 }
 
+void take_value (Value v) {
+}
+
+bool make_bool () {
+	return true;
+}
+
 void main () {
 	test_value ();
 	test_value_array ();
 	test_nullable_value ();
 	test_nullable_value_array ();
+	take_value (make_bool ());
 }



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