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 630184 - arrays in [SImpleType] vapi override has_destroy_function
arrays in [SImpleType] vapi override has_destroy_function
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Arrays
0.10.x
Other Linux
: Normal minor
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2010-09-20 16:48 UTC by Ilya Mezhirov
Modified: 2010-10-16 18:02 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Ilya Mezhirov 2010-09-20 16:48:47 UTC
I had a C struct like this:

    struct Foo
    {
        int data[4];
    };

The straightforward vapi was

-------- bug-vapi.vapi ---------
    [SimpleType]
    [CCode(has_copy_function = false, has_destroy_function = false)]
    struct Foo
    {
        public int data[4];
        public Foo();
    }
--------------------------------

and it was used simply:

----------- bug.vala -----------
    void main()
    {
        var foo = Foo();
    }
--------------------------------

Worked in 0.8, but in 0.10 ...
    $ valac --vapidir . --pkg bug-vapi bug.vala -C
    $ cat bug.c
    ...
    static void foo_destroy (Foo* self) {
    }


    void _vala_main (void) {
            Foo foo;
            foo = foo_init ();
            foo_destroy (foo);
    }
    ...

This doesn't compile (foo_destroy needs a pointer).
Anyway, I'm labeling this as a minor bug because it seems the correct way was
    public int *data;
Comment 1 Jürg Billeter 2010-10-16 18:02:12 UTC
commit df908b94f02bfd8f4c0e062dcc9d8da389ede175
Author: Jürg Billeter <j@bitron.ch>
Date:   Sat Oct 16 19:59:18 2010 +0200

    Do not consider fixed-length arrays as disposable
    
    Fixes bug 630184.