[Vala] Problem with closure values reference count



Hi Everyone,

I found some strange errors related to closures.
The following code triggers it (tested with every vala version form
0.9.8 trough 0.11.2):

unowned Thread t;

void bugMe() {
    string text = "bug me";
    t = Thread.create(() => {
            Thread.usleep((1000*1000) / 2);
            stdout.printf("%s\n", text);
            return null;
        }, true);
}

void main() {
    bugMe();

    t.join();
}

This short program prints "(null)" instead of "bug me".
It seems to me that closures don't do any refcounting for their BlockData.

Is this intended or a bug?

Regards,
Moritz



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