]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Fix criticals for interfaces without class prerequisite
authorJürg Billeter <j@bitron.ch>
Sun, 22 May 2011 21:10:26 +0000 (23:10 +0200)
committerJürg Billeter <j@bitron.ch>
Sun, 22 May 2011 21:10:26 +0000 (23:10 +0200)
Fixes bug 642804.

codegen/valaccodebasemodule.vala
vala/valainterface.vala

index b77cd806551b9bec2e35e24c18c6d603b4924875..1277cd190a5c6b88f082e3832da1266638f696b6 100644 (file)
@@ -5204,7 +5204,12 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                if (target_type.value_owned && (!type.value_owned || boxing || unboxing)) {
                        // need to copy value
                        if (requires_copy (target_type) && !(type is NullType)) {
-                               result = (GLibValue) copy_value (result, node);
+                               var copy = (GLibValue) copy_value (result, node);
+                               if (target_type.data_type is Interface && copy == null) {
+                                       Report.error (node.source_reference, "missing class prerequisite for interface `%s', add GLib.Object to interface declaration if unsure".printf (target_type.data_type.get_full_name ()));
+                                       return result;
+                               }
+                               result = copy;
                                // drop this assignment when target values are guaranteed to be effect-free
                                if (!(target_type is ArrayType && ((ArrayType) target_type).fixed_length)) {
                                        var decl = get_temp_variable (target_type, true, node, false);
index 92d9cbc4b4494beff381cd66b53c62773394e8ac..d189323e2c2f9013ef748a28ab044f57dad0b32f 100644 (file)
@@ -527,7 +527,7 @@ public class Vala.Interface : ObjectTypeSymbol {
                                return type_name;
                        }
                }
-               return null;
+               return "POINTER";
        }
 
        public override string? get_get_value_function () {
@@ -537,7 +537,7 @@ public class Vala.Interface : ObjectTypeSymbol {
                                return get_value_func;
                        }
                }
-               return null;
+               return "g_value_get_pointer";
        }
        
        public override string? get_set_value_function () {
@@ -547,7 +547,7 @@ public class Vala.Interface : ObjectTypeSymbol {
                                return set_value_func;
                        }
                }
-               return null;
+               return "g_value_set_pointer";
        }
 
        public override string? get_take_value_function () {
@@ -557,7 +557,7 @@ public class Vala.Interface : ObjectTypeSymbol {
                                return take_value_func;
                        }
                }
-               return null;
+               return "g_value_set_pointer";
        }
 
        public string? get_default_type_id () {
@@ -601,7 +601,7 @@ public class Vala.Interface : ObjectTypeSymbol {
                        }
                }
 
-               return null;
+               return "g_param_spec_pointer";
        }
 
        public override bool check (CodeContext context) {