After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 644679 - regression: InputStream.read_line_async
regression: InputStream.read_line_async
Status: RESOLVED DUPLICATE of bug 639211
Product: vala
Classification: Core
Component: Bindings
0.11.x
Other Linux
: Immediate blocker
: ---
Assigned To: Vala maintainers
Vala maintainers
regression test-case wrong-code
Depends on:
Blocks:
 
 
Reported: 2011-03-13 23:47 UTC by Nor Jaidi Tuah
Modified: 2011-04-02 14:33 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Nor Jaidi Tuah 2011-03-13 23:47:42 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.
Comment 1 Jürg Billeter 2011-04-02 14:33:45 UTC
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 ***