]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Owned struct parameters should not be const
authorMarc-André Lureau <marcandre.lureau@gmail.com>
Sat, 30 May 2009 16:18:59 +0000 (19:18 +0300)
committerJürg Billeter <j@bitron.ch>
Tue, 28 Jul 2009 13:44:14 +0000 (15:44 +0200)
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

index eb73b0f7ae2ce08a8935b9c75ae8eaa6e8e6ec2d..d76fbce168831825064c5f87da10b9b1934cafee 100644 (file)
@@ -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;
                                        }