mirror of
https://github.com/brl/mutter.git
synced 2025-06-14 01:09:30 +00:00
cleanup: Use g_clear_signal_handler() where possible
This is inspired by 98892391d7
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.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/940
This commit is contained in:

committed by
Florian Müllner

parent
22d1febf3c
commit
92375c75f8
@ -780,8 +780,8 @@ destroy_drag_focus (struct wl_listener *listener, void *data)
|
||||
|
||||
grab->drag_focus_data_device = NULL;
|
||||
|
||||
g_signal_handler_disconnect (grab->drag_focus,
|
||||
grab->drag_focus_destroy_handler_id);
|
||||
g_clear_signal_handler (&grab->drag_focus_destroy_handler_id,
|
||||
grab->drag_focus);
|
||||
grab->drag_focus = NULL;
|
||||
}
|
||||
|
||||
@ -852,8 +852,8 @@ meta_wayland_drag_grab_set_focus (MetaWaylandDragGrab *drag_grab,
|
||||
if (drag_grab->drag_focus)
|
||||
{
|
||||
meta_wayland_surface_drag_dest_focus_out (drag_grab->drag_focus);
|
||||
g_signal_handler_disconnect (drag_grab->drag_focus,
|
||||
drag_grab->drag_focus_destroy_handler_id);
|
||||
g_clear_signal_handler (&drag_grab->drag_focus_destroy_handler_id,
|
||||
drag_grab->drag_focus);
|
||||
drag_grab->drag_focus = NULL;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user