Re: [Vala] GtkSourceCompletion segfault



On Mon, Apr 26, 2010 at 14:31:35 +0200, Nicolas Joseph wrote:
Hello,

I test GtkSourceCompletion (include in GtkSourceView 2.10) and I rewrite in
vala this example:
http://git.gnome.org/browse/gtksourceview/tree/tests/test-completion.c?id=GTKSOURCEVIEW_2_10_0

I have a bug for add custom proposals (GtkSourceCompletionWords works fine
except a bug in the binding) as if they were freed, but I don't find problem
with valac.

The bug make a segfault:

*** glibc detected *** ./main: double free or corruption (fasttop):
0x00000000023d5110 ***

Or warning:

Gtk-WARNING **: Failed to set text from markup due to error parsing markup:
Error on line 1 char 13: Invalid UTF-8 encoded text in name - not valid
'\xe0F\xd3\u0001'

Have you an idea?

Maybe. It complains about "name" being wrong, right? So let's have a look at
what name is.

class TestProvider : Gtk.SourceCompletionProvider, Object
{
  public unowned string get_name ()
  {
        return this.name;
  }
}

However, the original code says:

    static gchar *
    test_provider_get_name (GtkSourceCompletionProvider *provider)
    {
        return g_strdup (((TestProvider *)provider)->name);
    }

which clearly implies the caller is going to free the string, so it's owned.
This can be confirmed by reading the documentation.

That seems like Gtk.SourceCompletionProvider binding is incorrect.
I can't find a .vapi binding that class -- where does it come from?

-- 
                                                 Jan 'Bulb' Hudec <bulb ucw cz>



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