Web lists-archives.com

Re: Development with GObjects

Nice work, Pavlo! I wonder if you can work this into a patch for the GObject documentation :-)

You might want to check out https://blogs.gnome.org/desrt/2012/02/26/a-gentle-introduction-to-gobject-construction/ as well.

In my personal style I would do three things differently, I don't know for sure whether I'm correct about these or how widespread they are as best practices:

- It's not necessary to override dispose or finalize if the only thing you do is chain up.
- I would free self->name in finalize instead of dispose, along with any other memory that is fully owned by the MyPoint instance. In dispose, I would only drop any references to memory that had been passed in through MyPoint's API.
- I think it's confusing to have my_point_free() that calls g_clear_object(), since usually g_object_unref() is known as the standard way to release a reference to a GObject, and it doesn't necessarily free the object if there are other references.

Best regards,
Philip C

On Fri, Aug 17, 2018 at 3:11 PM Pavlo S. via gtk-devel-list <gtk-devel-list@xxxxxxxxx> wrote:
I am putting together a tutorial how to use GObject. It is my
interpretation and I was trying to keep is as simple as possible and
clear for new users.



- Pavlo Solntsev
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

Sent from Evolution on GNU/Debian <www.debian.org>

gtk-devel-list mailing list
gtk-devel-list mailing list