summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOle André Vadla Ravnås <oleavr@gmail.com>2017-01-15 19:28:00 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2017-01-16 15:54:06 +0100
commitbbff74e9d9d7c44d95504af1b9b0369d63752cea (patch)
treebb8347baf8ab53ec357d830190bc473ce0b94287
parent0d3ed86477736bdf12ef32c69fc5050b18a0d1ed (diff)
downloadvala-bbff74e9d9d7c44d95504af1b9b0369d63752cea.tar.gz
tests: Add testcase for double-free regression
https://bugzilla.gnome.org/show_bug.cgi?id=777242
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/asynchronous/bug777242.vala23
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f7efca876..0db7170a6 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -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
index 000000000..2fe686de0
--- /dev/null
+++ b/tests/asynchronous/bug777242.vala
@@ -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 ();
+}