After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 747615 - InitiallyUnowned issues with GomFilter
InitiallyUnowned issues with GomFilter
Status: RESOLVED OBSOLETE
Product: gom
Classification: Other
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Gom Maintainers
Gom Maintainers
Depends on:
Blocks: 753379
 
 
Reported: 2015-04-10 12:06 UTC by Alexander Larsson
Modified: 2019-03-20 10:38 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Alexander Larsson 2015-04-10 12:06:26 UTC
GomFilter is currently an InitiallyUnowned.
This lets you write things like:
      gom_filter_new_and (gom_filter_new_eq (TYPE, "foo", &value1),
                          gom_filter_new_eq (TYPE, "bar", &value2))

without manually freeing the inner filter objects

However, this actually leaks because we never actually sink filter anywhere.

gom_filter_new_for_subfilters_full(), gom_filter_new_for_subfilters_fullv() and gom_resource_group_set_filter() should clearly ref_sink() the filters to make the above work.

However, the question is what to do with the toplevel. Does a call to gom_repository_find() sink the filter or not? If it does, then you have to manually ref_sink a filter that you use multiple times, and if it does not, then you have to always ref_sink + unref a filter used to find something.

Also, such a change may cause crashes with existing code (for instance if something calls two find() with a single filter.

Probably the right fix is to make GomFilter not be InitiallyUnowned. The advantage here is not worth the confusion. This is also pretty safe, only risk is leaks in existing code.
Comment 1 GNOME Infrastructure Team 2019-03-20 10:38:36 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gom/issues/7.