Skip to content

Add g_file_copy_async_with_closures() and g_file_move_async_with_closures()

g_file_copy_async() and g_file_move_async() are written in a way that is not bindable with gobject-introspection. The progress callback data can be freed once the async callback has been called, which is convenient for C, but in language bindings the progress callback closure is currently just leaked.

There is no scope annotation that fits how the progress callback should be treated:

  • (scope call) is correct for the sync versions of the functions, but incorrect for the async functions; the progress callback is called after the async functions return.
  • (scope notified) is incorrect because there is no GDestroyNotify parameter, meaning the callback will always leak.
  • (scope async) is incorrect because the callback is called more than once.
  • (scope forever) is incorrect because the callback closure could be freed after the async callback runs.

This adds g_file_copy_async_with_closures() and g_file_move_async_with_closures() for the benefit of language bindings.

See: gjs#590

Note, this is marked as a draft because as a new API, it should wait until the GNOME 47 cycle to land. There is a temporary commit incrementing the version so that we generate the correct visibility macros, which should disappear when rebasing next cycle. Despite the draft status, it is ready for review.

Merge request reports