While performing an async i/o on a source-object ( Eg. GFile ), whose responsibility is it to keep the source-object alive when the GAsyncReadyCallback is invoked.
Looks like GFile async operations use GTask currently for achieving async capability. GTask ref counts the source-object on creation and unrefs upon finalize, after GAsyncReadyCallback is invoked. So, it does appear the g_file_* functions take care of the ref count here. But, that is an implementation detail.
Currently, there is no mention of who maintains ref count in the GLib API documentation.
Not sure if this is explicitly documented anywhere, but it is not just an implementation details. It is an expected aspected of the async pattern that is prevalent in GIO and the GTK stack that “the system” keeps a reference to the source object until after finish().
The main issue was to know, what is the best place to unref the source object ?
Because in some GNOME projects, I saw this being done in the callback, and in others immediately after the async call. Some minimal documentation should have cleared this issue.