[Issue 2162] Access violation when threads run closures

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Oct 3 06:44:01 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2162


brunodomedeiros+bugz at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |brunodomedeiros+bugz at gmail.c
                   |                            |om




------- Comment #1 from brunodomedeiros+bugz at gmail.com  2008-10-03 08:43 -------
Bump! I've recently run into this as well.

The problem happens when the context of the passed delegate is in the stack.
If the context of the passed delegate is in the heap, all is fine. If you add
this code to th end of test():

...
    thr1 = new Thread(&run1);
    thr2 = new Thread(&run2);

    auto dummy = (&run1);
}

---
The program will run correctly, as the context will be on the heap.
So I think the problem might just be incorrect closure detection?


-- 



More information about the Digitalmars-d-bugs mailing list