]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add testcase for double-free regression
authorOle André Vadla Ravnås <oleavr@gmail.com>
Sun, 15 Jan 2017 18:28:00 +0000 (19:28 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 16 Jan 2017 14:54:06 +0000 (15:54 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=777242

tests/Makefile.am
tests/asynchronous/bug777242.vala [new file with mode: 0644]

index f7efca876ec441d0b98361cd919c5f1210e847bc..0db7170a6ecac14a561b03245c3ff68dfc2a05b1 100644 (file)
@@ -231,6 +231,7 @@ TESTS = \
        asynchronous/bug661961.vala \
        asynchronous/bug742621.vala \
        asynchronous/bug762819.vala \
+       asynchronous/bug777242.vala \
        asynchronous/closures.vala \
        asynchronous/generator.vala \
        asynchronous/yield.vala \
diff --git a/tests/asynchronous/bug777242.vala b/tests/asynchronous/bug777242.vala
new file mode 100644 (file)
index 0000000..2fe686d
--- /dev/null
@@ -0,0 +1,23 @@
+int i = 0;
+
+async void run () {
+       while (true) {
+               string foo;
+               if (i == 0) {
+                       foo = "foo";
+                       i++;
+               } else {
+                       break;
+               }
+       }
+}
+
+void main() {
+       var loop = new MainLoop ();
+       Idle.add (() => {
+               run.begin ();
+               loop.quit ();
+               return false;
+       });
+       loop.run ();
+}