From bbff74e9d9d7c44d95504af1b9b0369d63752cea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Andr=C3=A9=20Vadla=20Ravn=C3=A5s?= Date: Sun, 15 Jan 2017 19:28:00 +0100 Subject: tests: Add testcase for double-free regression https://bugzilla.gnome.org/show_bug.cgi?id=777242 --- tests/Makefile.am | 1 + tests/asynchronous/bug777242.vala | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 tests/asynchronous/bug777242.vala (limited to 'tests') 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 (); +} -- cgit v1.2.1