[vala] Owned struct parameters should not be const



commit 3ae7deee30862c281ec43e947a9bc99e861cbd4f
Author: Marc-André Lureau <marcandre lureau gmail com>
Date:   Sat May 30 19:18:59 2009 +0300

    Owned struct parameters should not be const
    
    This code fails to compile, because vala tries to free() a const value.
    
       public virtual void qset (Quark field, owned Value? value) {
          ...
       }

 codegen/valaccodemethodmodule.vala |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valaccodemethodmodule.vala b/codegen/valaccodemethodmodule.vala
index eb73b0f..d76fbce 100644
--- a/codegen/valaccodemethodmodule.vala
+++ b/codegen/valaccodemethodmodule.vala
@@ -660,7 +660,7 @@ internal class Vala.CCodeMethodModule : CCodeStructModule {
 			if (param.parameter_type.data_type is Struct) {
 				var st = (Struct) param.parameter_type.data_type;
 				if (!st.is_simple_type () && param.direction == ParameterDirection.IN) {
-					if (st.use_const) {
+					if (st.use_const && !param.parameter_type.value_owned) {
 						ctypename = "const " + ctypename;
 					}
 



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