Re: [Vala] Bug: If you have a variable called stdout, calls to GLib.stdout crashes



Sorry, something broke along the way.

Good morning everyone.
And another bug:

using GLib;

/**
Bug report:
GLib.stdout.printf or Posix.stdout.printf crashes if there is a local variable called stdout

*/

class Myclass : Object{
    public bool i_wanna_die=false;

    public void kaboom(string stdout, out string stderr){
        if(i_wanna_die){
            GLib.stdout.printf("Oooops\n");  //This line causes a crash
        }
        stdout = "qwerty";
        stderr = "asdf";

    }

}

public int main(string args[])
{
    var t1 = new Myclass();

    string output="";
    string error="";

    stdout.printf("I will survive this!\n");
    t1.kaboom(output, out error);
    stdout.printf("Yay, I survived!\n");

stdout.printf("Let's try it again, this time I might not survive...\n");
    stdout.flush();

    t1.i_wanna_die = true;
    t1.kaboom(output, out error);

    stdout.printf("Yay, I survived!\n");
    return 0;
}


Best regards,
Javier



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