Re: [gnome-db] GdaColumn and GdaColumnIndex



On Wed, 2005-10-05 at 14:11 +0200, Vivien Malerba wrote:
2005/10/5, Bas Driessen <bas driessen xobas com>:
>  Hello,
>
>  Still having a strange problem. Hope someone can help advise.
>
>  This works:
>
>  int main(int argc, char **argv)
>  {
>     gda_init("test", "1.0", argc, argv);
>     GdaColumn *abc = gda_column_new();
>     g_object_unref(abc);
>  }
>
>  This does not work:
>
>  int main(int argc, char **argv)
>  {
>     gda_init("test", "1.0", argc, argv);
>     GdaColumnIndex *abc = gda_column_index_new();
>     g_object_unref(abc);
>  }
>
>  This generates the warning: GLib-GObject-CRITICAL **: g_type_free_instance:
> assertion `instance != NULL && instance->g_class != NULL' failed
>
>  Both "new" functions only call g_object_new in libgda. My understanding is
> that I should use g_object_unref to free the mem (rather than g_free).

Yes, never call g_free() on an object!

>
>  When comparing the GdaColumn and GdaColumnIndex implementations in libgda,
> the only structural difference I can see is that the GdaColumnIndex does not
> have any signals. Anyway, after putting a signal in place it still fails.
>
>  Am I overlooking something simple, or is there an issue here?

There is a bug in the gda_column_index_finalize() function: there is a
g_free() there wich does it all... If you remove that line, then I'll
be fine.

Here is the patch attached (which also corrects another potention
problem). I'll commit the patch to CVS tonight.

The finalize function. The one place I didn't look ....  :) well :(   Thanks for that Vivien. I see that there is also a change to the gda_column_index_set_references function. The gda_column_set_references function probably requires the same fix.

Thanks for your help on this one.

Bas.



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