Re: gobject
- From: Timothy Ward <gtwa001 gmail com>
- To: Emmanuele Bassi <ebassi gmail com>
- Cc: ML-gtk <gtk-list gnome org>
- Subject: Re: gobject
- Date: Fri, 21 Oct 2016 00:50:42 +1100
On Thu, 2016-10-20 at 12:18 +0100, Emmanuele Bassi wrote:
Hi;
you should probably try and keep the thread, instead of breaking
with
every new email.
Unfortunately Evolution or Evolution data server has been playing up
and displaying downloaded messages with no subject or anything else,
in a message, it was only when I actually had a look directly at the
mailing list that I discovered this new message reply. Did not
actually receive the replied message. So had to improvise.
On 20 October 2016 at 11:32, Timothy Ward <gtwa001 gmail com> 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?
How to code both types - explanation of the boiler plate code
what it is for and how to code it.
Explanation of the new style and the advantages of using it.
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 great info Thanks.
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
type.
There's an overview of how memory management for a GObject type
available here:
https://developer.gnome.org/gobject/stable/gobject-memory.html
Again, feel free to file bugs against the GLib product:
https://bugzilla.gnome.org/enter_bug.cgi?product=glib
pointing out issues with the current documentation (possible one per
issue).
Shall do
Regards
Tim
Ciao,
Emmanuele.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]