GNOME Bugzilla – Bug 747615
InitiallyUnowned issues with GomFilter
Last modified: 2019-03-20 10:38:36 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.
-- 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.