[Vala] string property problem



does Vala 0.7.8/0.7.9 generate bad code for string property? 

vala source(prop.vala):

public class Test : Object
{
  public string prop { get; set; }
}
void main ()
{
  var test = new Test ();
  debug ("%s", test.prop);
}

use `valac prop.vala` generate below C code:

 ......
static void test_class_init (TestClass * klass) {
        test_parent_class = g_type_class_peek_parent (klass);
        g_type_class_add_private (klass, sizeof (TestPrivate));
        G_OBJECT_CLASS (klass)->get_property = test_get_property;
        G_OBJECT_CLASS (klass)->set_property = test_set_property;
        G_OBJECT_CLASS (klass)->finalize = test_finalize;
        g_object_class_install_property (G_OBJECT_CLASS (klass),
TEST_PROP, g_param_spec_boxed ("prop", "prop", "prop", NULL,
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB |
G_PARAM_READABLE | G_PARAM_WRITABLE));
}
......

and compile it get below warning:

prop.vala.c: In function 'test_class_init':
prop.vala.c:90: warning: passing argument 4 of 'g_param_spec_boxed'
makes integer from pointer without a cast
Compilation succeeded - 1 warning(s)

and run generated program, will get below error:

(process:31877): GLib-GObject-CRITICAL **: g_param_spec_boxed: assertion
`G_TYPE_IS_BOXED (boxed_type)' failed

(process:31877): GLib-GObject-CRITICAL **:
g_object_class_install_property: assertion `G_IS_PARAM_SPEC (pspec)'
failed
** (process:31877): DEBUG: prop.vala:9: (null)

If use Vala 0.7.5, generated C code and program has not this problem.

i have install vala0.7.8/0.7.9 from source, and install prefix is
$HOME/somedir.

thanks advance!


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