Skip to content

utils: Add g_steal_handle_id() to complement g_clear_handle_id()

Philip Withnall requested to merge pwithnall/glib:steal-handle-id into main

Just like we have g_steal_pointer() and g_clear_pointer(), it would be useful to have a ‘steal’ version of g_clear_handle_id().

Particularly in situations where a clear function can’t be represented as a GClearHandleFunc, such as g_dbus_connection_signal_unsubscribe() (there’s no way of passing the GDBusConnection to it) — or in situations where a handle ID isn’t being released, but is being passed from one struct to another or from a local scope to a struct or vice-versa.

Includes unit tests.

Signed-off-by: Philip Withnall pwithnall@gnome.org

Merge request reports

Loading