[Vala] Regression on async with nullable out parameters



The following crashed when compiled with Vala 0.11.6.
This is a regression since it works with 0.9.x.

---------------------------
public class Bug {
    uint8[] data;
    DataInputStream input;
    Cancellable cancellable;

    public Bug () {
        data = "hello world\ntesting\n".data;
        input = new DataInputStream (new MemoryInputStream.from_data
(data, null));
        cancellable = new Cancellable ();
        run.begin ();
        new MainLoop (null, false).run ();
    }
    private async void run () {
        try {
            string line;
            size_t length;
            while ((line = yield input.read_line_async (100,
cancellable, out length)) != null) {
                    stdout.printf ("%s\n", line);
                    if (cancellable.is_cancelled ()) break;
            }
        }
        catch (Error e) {
            stderr.printf ("Error: %s\n", e.message);
        }
    }

    public static void main () {
        new Bug();
    }
}
---------------------------

When the while expression is changed to 

    while ((line = yield input.read_line_async (100, cancellable,
null)) != null) {

then it works. i.e. "out length" doesn't work, but "null" does.

Is this a known regression?

hand
Nor Jaidi Tuah





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