GPtrArray API is prone to leak

Bug #718178 reported by Michal Hruby
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libzeitgeist
Triaged
Wishlist
Unassigned

Bug Description

Now that there's GObject-Introspection planned for libzg, it'd be very useful to add methods which do not consume the GPtrArray templates parameter present in many methods, as libzg is doing a lot of ref-counting magic there.

As an example, doing:
GPtrArray templates = g_ptr_array_new_with_free_func (g_object_unref);
g_ptr_array_add (g_object_ref_sink (some_event));
zeitgeist_log_find_events (zg_log, time_range, g_ptr_array_ref (templates), ...);
g_ptr_array_unref (templates);

Will result in mem leak, because the find_events call will change the free_func on the templates.

Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote : Re: [Bug 718178] [NEW] GPtrArray API is prone to leak

I agree. The current API was developed maybe with a little to much
focus on a convenient C API. Fixing this will be an API break
nonetheless, so we can target this for the 0.4 series - at which point
we should probably also switch the VAPI to use GenericArray instead of
pointer array.

Kalle Valo (kvalo)
Changed in libzeitgeist:
importance: Undecided → Wishlist
status: New → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.