[Vala] Implementing Interfaces with Same Property Name



Hello,

I’m running into an issue when an object implements two interfaces that specify the same property. Function 
pointers for one of the interfaces are not getting initialized. When called through the interface, the 
program encounters a SIGSEGV.  A small program to replicate the issue follows:

    interface First : Object
    {
        public abstract int number { get; set; }
    }

    interface Second : Object
    {
        public abstract int number { get; set; }
    }

    class Tester : Object, First, Second
    {
        public int number { get; set; }

        public static void main()
        {
            var temp = new Tester();

            temp.number = 1;
            (temp as First).number = 2;

            // SIGSEGV
            (temp as Second).number = 3;
        }
    }

In the output C code, the function pointers for the second interface are not initialized:

    static void
    tester_first_interface_init (FirstIface * iface)
    {
    #line 11 "/home/ehennes/Projects/vala_errors/test.vala"
            tester_first_parent_iface = g_type_interface_peek_parent (iface);
    #line 11 "/home/ehennes/Projects/vala_errors/test.vala"
            iface->get_number = tester_real_get_number;
    #line 11 "/home/ehennes/Projects/vala_errors/test.vala"
            iface->set_number = tester_real_set_number;
    #line 311 "test.c"
    }


    static void
    tester_second_interface_init (SecondIface * iface)
    {
    #line 11 "/home/ehennes/Projects/vala_errors/test.vala"
            tester_second_parent_iface = g_type_interface_peek_parent (iface);
    #line 320 "test.c”
    }

Should objects be allowed to inherit from interfaces that specify the same property?

Thanks,
Ed


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