GNOME Bugzilla – Bug 644679
regression: InputStream.read_line_async
Last modified: 2011-04-02 14:33:45 UTC
The following crashed when compiled with Vala 0.11.6. This is a regression since it works with 0.9.x. [Abderrahim Kitouni commented on vala mail list: This is a bug in the bindings: length shouldn't be nullable in this case.] --------------------------- 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.
Thanks for taking the time to report this bug. This particular bug has already been reported into our bug tracking system, but we are happy to tell you that the problem has already been fixed. It should be solved in the next software version. You may want to check for a software upgrade. *** This bug has been marked as a duplicate of bug 639211 ***