]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: fix criticals when duplicating unowned instnaces
authorLuca Bruno <lucabru@src.gnome.org>
Sat, 30 Jan 2016 13:11:04 +0000 (14:11 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sun, 31 Jan 2016 08:23:55 +0000 (09:23 +0100)
Fixes bug 632174

(cherry picked from commit bc4fc3dcd6bd5e9b266c3158a033acfa8e64ee89)

codegen/valaccodebasemodule.vala

index 78e52dc07937c7e86c3abb956153876b0e1bacf5..3fd598a853fbbbb32c21c18c78716dcd2fdf909a 100644 (file)
@@ -2622,7 +2622,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                dup_function = get_ccode_ref_function ((ObjectTypeSymbol) type.data_type);
                                if (type.data_type is Interface && dup_function == null) {
                                        Report.error (source_reference, "missing class prerequisite for interface `%s', add GLib.Object to interface declaration if unsure".printf (type.data_type.get_full_name ()));
-                                       return null;
+                                       return new CCodeInvalidExpression();
                                }
                        } else if (cl != null && cl.is_immutable) {
                                // allow duplicates of immutable instances as for example strings
@@ -2646,7 +2646,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        } else {
                                // duplicating non-reference counted objects may cause side-effects (and performance issues)
                                Report.error (source_reference, "duplicating %s instance, use unowned variable or explicitly invoke copy method".printf (type.data_type.name));
-                               return null;
+                               return new CCodeInvalidExpression();
                        }
 
                        return new CCodeIdentifier (dup_function);