Skip to content

cleanup: Use g_clear_signal_handler() where possible

From the main commit:

This is inspired by 98892391d764d1cf where the usage of
`g_signal_handler_disconnect()` without resetting the corresponding
handler id later resulted in a bug. Using `g_clear_signal_handler()`
makes sure we avoid similar bugs and is almost always the better
alternative. We use it for new code, let's clean up the old code to
also use it.

A further benefit is that it can get called even if the passed id is
0, allowing us to remove a lot of now unnessecary checks, and the fact
that `g_clear_signal_handler()` checks for the right type size, forcing us
to clean up all places where we used `guint` instead of `gulong`.

No functional changes intended here and all changes should be trivial,
thus bundled in one big commit.

The second commit was split out as it closes a signal leak and should get cherry-picked to stable branches.

This removes almost all usages of g_signal_handler_disconnect(). I left out clutter-animation.c as it will get cleaned up soonish AFAIK.

See also !868 (merged)

Edited by Robert Mader

Merge request reports