gdbusconnection: Document main context iteration for unsubscriptions

Add a note to the documentation of
`g_dbus_connection_signal_unsubscribe()`, `g_bus_unwatch_name()` and
`g_bus_unown_name()` warning about the need to continue iterating the
caller’s thread-default `GMainContext` until the
unsubscribe/unwatch/unown operation is complete.

See the previous few commits and #1515 for an idea of the insidious bugs
that can be caused by not iterating the `GMainContext` until
everything’s synchronised.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall
2020-02-21 15:12:08 +00:00
parent 0f0af5ae3a
commit ab285899a6
3 changed files with 22 additions and 0 deletions

View File

@@ -858,6 +858,13 @@ guint g_bus_watch_name_on_connection_with_closures (
*
* Stops watching a name.
*
* Note that there may still be D-Bus traffic to process (relating to watching
* and unwatching the name) in the current thread-default #GMainContext after
* this function has returned. You should continue to iterate the #GMainContext
* until the #GDestroyNotify function passed to g_bus_watch_name() is called, in
* order to avoid memory leaks through callbacks queued on the #GMainContext
* after its stopped being iterated.
*
* Since: 2.26
*/
void