mirror of
				https://gitlab.gnome.org/GNOME/glib.git
				synced 2025-11-04 10:08:56 +01:00 
			
		
		
		
	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:
		@@ -3694,6 +3694,14 @@ unsubscribe_id_internal (GDBusConnection *connection,
 | 
			
		||||
 *
 | 
			
		||||
 * Unsubscribes from signals.
 | 
			
		||||
 *
 | 
			
		||||
 * Note that there may still be D-Bus traffic to process (relating to this
 | 
			
		||||
 * signal subscription) 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_dbus_connection_signal_subscribe() is called, in order to avoid memory
 | 
			
		||||
 * leaks through callbacks queued on the #GMainContext after it’s stopped being
 | 
			
		||||
 * iterated.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 2.26
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
 
 | 
			
		||||
@@ -889,6 +889,13 @@ g_bus_own_name_on_connection_with_closures (GDBusConnection    *connection,
 | 
			
		||||
 *
 | 
			
		||||
 * Stops owning a name.
 | 
			
		||||
 *
 | 
			
		||||
 * Note that there may still be D-Bus traffic to process (relating to owning
 | 
			
		||||
 * and unowning 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_own_name() is called, in
 | 
			
		||||
 * order to avoid memory leaks through callbacks queued on the #GMainContext
 | 
			
		||||
 * after it’s stopped being iterated.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 2.26
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
 
 | 
			
		||||
@@ -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 it’s stopped being iterated.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 2.26
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user