Are structs saved in multi-thread delegate call?

ag0aep6g via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Apr 22 22:35:32 PDT 2016


On 23.04.2016 03:11, Ramon wrote:
> mmm, I figured the problem, but don't know how to solve it.
> my struct has a destructor which clears itself:
>
> struct json_value
> {
>    ~this() { .ValueClear(&data); }
> }

So the struct is destroyed at the end of DoDirSearch, despite there 
being a closure for it. Is the compiler doing the right thing here? 
Shouldn't the struct be considered alive until the closure gets garbage 
collected?


More information about the Digitalmars-d-learn mailing list