Re: [Vala] How to implement the get_type method of Gst.URIHandler interface in vala?



Adding the CCode to the vala code solved the problem. Thank you!

I generated two bug reports for this discussion: *Bug
726744*<https://bugzilla.gnome.org/show_bug.cgi?id=726744>and
*Bug 726745* <https://bugzilla.gnome.org/show_bug.cgi?id=726745> .

Regards,

LM


On Wed, Mar 19, 2014 at 4:42 AM, Luca Bruno <lethalman88 gmail com> wrote:

On 18/03/2014 23:25, Lei Miao wrote:

That worked! Thank you so much for the help!

I still have a related question though:

In the following function in the generated c code,

static gchar**my_streaming_source_real_get_protocols (GstURIHandler*
base, GType type, int* result_length1) {
    MyStreamingSource * self;
    gchar** result = NULL;
    gchar** _tmp0_ = NULL;
    gint _tmp0__length1 = 0;
    self = (MyStreamingSource*) base;
    _tmp0_ = MY_STREAMING_SOURCE_protocols;
    _tmp0__length1 = G_N_ELEMENTS (MY_STREAMING_SOURCE_protocols);
    if (result_length1) {
        *result_length1 = _tmp0__length1;
    }
    result = _tmp0_;
    return result;
}

the last argument "int* result_length1" somehow is causing seg faults. If
I remove this argument manually, then the problem goes away.

I was wondering why this argument is added, since in the vapi, I only
have:

        [CCode (array_length = false, array_null_terminated = true)]
        public abstract unowned string[] get_protocols (GLib.Type type);

and in the vala code, I have

"public unowned string[] get_protocols(Type type) { return protocols; }"
where "protocols" is a string array.

Is there a way to remove this argument in the generated c code?

Try putting [CCode (array_length = false, array_null_terminated = true)]
on your method as well.
Also if you can, please report a bug. That CCode should have been
inherited automatically by vala.



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