InitiallyUnowned issues with GomFilter
@alexl
Submitted by Alexander Larsson Link to original bug (#747615)
Description
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.