Re: Development with GObjects
- From: philip chimento gmail com
- To: p sun fun gmail com
- Cc: GTK Devel List <gtk-devel-list gnome org>
- Subject: Re: Development with GObjects
- Date: Sat, 18 Aug 2018 16:02:41 -0400
Nice work, Pavlo! I wonder if you can work this into a patch for the GObject documentation :-)
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]