Don't use g_type_class_add_privat(). Either use the define type with
private macro, or the define type with code macro with G_ADD_PRIVATE.

Also, do not store a private pointer in your instance structure, and use
the get_private_instance() function that the G_DEFINE_TYPE macro creates
for you.

The GObject tutorial has a good introduction on how to define types and how
to use them.

Ciao,
 Emmanuele.
On Tue, 21 Mar 2017 at 19:57, Nicola Fontana <n...@entidi.it> wrote:

> Il Tue, 21 Mar 2017 17:55:31 +0000 Tristan Van Berkom <
> tristan.vanber...@codethink.co.uk> scrisse:
>
> > ...
> >   o I believe the lookups with G_TYPE_INSTANCE_GET_PRIVATE() are just
> >     as cheap as the pointer dereference (as it will be implemented
> >     using simple pointer arithmetic).
>
> Hi Tristan,
>
> the lookup indeed is quite expensive, and looking at the
> implementation [1] it is not that straightforward.
>
> The very same example provided by the official documentation [2]
> caches that pointer into the instance struct.
>
> [1] https://git.gnome.org/browse/glib/tree/gobject/gtype.c#n4709
> [2]
> https://developer.gnome.org/gobject/stable/gobject-Type-Information.html#g-type-class-add-private
>
> Ciao.
> --
> Nicola
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

-- 
https://www.bassi.io
[@] ebassi [@gmail.com]
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to