From: Ole André Vadla Ravnås Date: Sun, 15 Jan 2017 18:28:00 +0000 (+0100) Subject: tests: Add testcase for double-free regression X-Git-Tag: 0.35.4~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bbff74e9d9d7c44d95504af1b9b0369d63752cea;p=thirdparty%2Fvala.git tests: Add testcase for double-free regression https://bugzilla.gnome.org/show_bug.cgi?id=777242 --- 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 (); +}