[vala/staging: 2/2] tests: Add testcase for double-free regression



commit bbff74e9d9d7c44d95504af1b9b0369d63752cea
Author: Ole André Vadla Ravnås <oleavr gmail com>
Date:   Sun Jan 15 19:28:00 2017 +0100

    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(+), 0 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f7efca8..0db7170 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 0000000..2fe686d
--- /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 ();
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]