]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Don't create null-safe destroy-wrapper for GenericType ac0dbad019e33c073c423e45fec2da562c7b6264
authorGeorge Barrett <bob@bob131.so>
Wed, 6 Dec 2017 14:51:05 +0000 (15:51 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 6 Dec 2017 23:06:06 +0000 (00:06 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=791283

codegen/valaccodebasemodule.vala
tests/Makefile.am
tests/methods/bug791283.vala [new file with mode: 0644]

index 059399e16776abc73aa92dc96b07e7a43145de28..f99acce089ffb918adbce628074579b1d3567320 100644 (file)
@@ -3082,7 +3082,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        public CCodeExpression? get_destroy0_func_expression (DataType type, bool is_chainup = false) {
                var element_destroy_func_expression = get_destroy_func_expression (type, is_chainup);
 
-               if (element_destroy_func_expression is CCodeIdentifier) {
+               if (!(type is GenericType) && element_destroy_func_expression is CCodeIdentifier) {
                        var freeid = (CCodeIdentifier) element_destroy_func_expression;
                        string free0_func = "_%s0_".printf (freeid.name);
 
index ffaa3cfa0fc30c635d15c3123edbd818f612252f..efc54d317c8b356d43a2475aec1f1d9729730264 100644 (file)
@@ -99,6 +99,7 @@ TESTS = \
        methods/bug781061.vala \
        methods/bug784691.vala \
        methods/bug791215.vala \
+       methods/bug791283.vala \
        methods/generics.vala \
        methods/printf-invalid.test \
        methods/printf-constructor.vala \
diff --git a/tests/methods/bug791283.vala b/tests/methods/bug791283.vala
new file mode 100644 (file)
index 0000000..569d8b1
--- /dev/null
@@ -0,0 +1,16 @@
+class Foo<T> {
+       GenericArray<T> bar;
+
+       public Foo () {
+               bar = new GenericArray<T> ();
+       }
+}
+
+GenericArray<G> create_bar<G> () {
+       return new GenericArray<G> ();
+}
+
+void main () {
+       var foo = new Foo<string> ();
+       var bar = create_bar<int?> ();
+}