Web lists-archives.com

Re: gobject


you should probably try and keep the thread, instead of breaking with
every new email.

On 20 October 2016 at 11:32, Timothy Ward <gtwa001@xxxxxxxxx> wrote:

> The referenced docs are good but only up to a point.

Patches are very welcome; we recently landed a whole review of the
GObject tutorial, and feedback helps improving the documentation.

> Their seems to be two methods used A) one that used a boiler plate
> type declarations code etc and B) one that uses the G_DECLARE type
> declarations. OLD and NEW.

Yes. Ideally, the "new" style, with G_DECLARE_* and G_DEFINE_TYPE,
should be used for all newly written code, as it allows not only
hiding the internals of the type system, but also allows GLib
maintainer to update the best practices for creating types without
requiring vast amounts of code rewrites — just a rebuild.

> The referenced docs do not provided full explanations or examples of
> either.

What kind of full explanation are you looking for, precisely?

> Gobject destruction is not fully described as when object dispose
> and object finalize should be used for an given Gobjects destruction
> and examples of correct use.

That's a good point, and a good example.

In general, dispose() is only meant for releasing references acquired
on other refcounted types that were associated to an instance of your
type; since dispose() can be called multiple times, it allows breaking
reference cycles.

On the other hand, finalize() is going to be called once, and it
should be used to release all memory allocated by an instance of your

There's an overview of how memory management for a GObject type available here:


Again, feel free to file bugs against the GLib product:


pointing out issues with the current documentation (possible one per issue).


[@] ebassi [@gmail.com]
gtk-list mailing list