I am new to glibmm and am looking at the documentation for Glib::TimeZone c++ class. There are a few places, eg,. Glib::TimeZone::create_utc() where it states:
"You should release the return value by calling g_time_zone_unref() when you are done with it."
This seems odd for a C++ class.
Looking in the source code for the destructor of Glib::TimeZone, g_time_zone_unref() is called there, so am I right in thinking that I should ignore the statement in the documentation?
It seems a lot of the documentation refers to glib rather than glibmm, as if it's been generated from the underlying glib docs. Is this so? Should I be taking all the docs with a pinch of salt?
I'm using glibmm-2.68
It is sort of explained in the source code: https://gitlab.gnome.org/GNOME/glibmm/-/blob/master/glib/src/timezone.hg#L54-61
So
g_time_zone_ref()andg_time_zone_unref()are called automatically by the C++Glib::TimeZoneclass. You should not call them explicitly.The source code also says
create()is deprecated and you should usecreate_identifier()instead. The difference is thatcreate()returns the UTC zone if parsing failed, which makes it impossible to know if parsing failed, whilecreate_identifier()returns null on error.Why does the online documentation mention
g_time_zone_unref()? Because it is auto-generated from the C documentation and the generator is not smart enough. An object lesson about the perils of generated documentation.