Re: [Vala] arrays of strings not properly initialized.



Hi Xavier,

On Tue, 2007-08-14 at 16:35 +0200, Xavier Bestel wrote:
Hi,

When writing that code:

        string[] tabs = new string[3] { "az", "er", "ty" }
        tabs[1] = "smorlbluck";

Vala initializes the array with static strings, which is wrong (and
fails when it tries to free(tabs[1]) before reassigning it).

Generated code:

        __temp1 = NULL;
        __temp0 = NULL;
        tabs = (__temp1 = (__temp0 = g_new0 (char*, 3), __temp0[0] = "az", __temp0[1] = "er", __temp0[2] = 
"ty", __temp0), tabs_length1 = 3, __temp1);
        __temp2 = NULL;
        tabs[1] = (__temp2 = g_strdup ("smorlbluck"), (tabs[1] = (g_free (tabs[1]), NULL)), __temp2);
        (tabs = (g_strfreev (tabs), NULL));


      Xav
Fixed in SVN.

Raffaele




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