[Bug 63402] Avatar image caching is not asynchronous

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Sep 17 04:26:07 PDT 2013


https://bugs.freedesktop.org/show_bug.cgi?id=63402

--- Comment #11 from Simon McVittie <simon.mcvittie at collabora.co.uk> ---
(In reply to comment #6)
> > +  avatar_file = g_file_new_for_path (filename);
> > 
> > You don't unref this, so it's leaked. Unref it after calling
> > g_file_replace_contents_async().
> 
> Done, but how do you know g_file_replace_contents_async() keeps it's own
> reference?

Because GAsyncResult functions (those that have a non-NULL source object,
anyway) always do. g_async_result_get_source_object returns the source object,
so any correct implementation of that API must be keeping a ref to that source
object.

(This convention is why I was surprised that you turned out to be right about
the avatar data - I expected the function to copy that, too, so that the caller
didn't have to keep it around.)

> > This should be in a new function avatar_file_written_data_free() (or
> > write_avatar_data_free() if you use the naming I suggested) so you don't
> > have to keep duplicating it.
> 
> I guess this isn't required now.

If you only have one code path by getting rid of the early-return (after
writing out the avatar but without writing out the MIME type): no, it isn't
needed (although I often split it out anyway - the compiler will inline it if
appropriate).

-- 
You are receiving this mail because:
You are the QA Contact for the bug.


More information about the telepathy-bugs mailing list