backends/native: Unref/unset key repeat GSource when cleared

This GSource is not being properly unref nor the variable holding it
cleared. This on one hand leaks the GSource memory, on the other hand
may trigger warnings in keyboard_repeat() as the source may be
(reentrantly) cleared, yet we don't exit early as
seat_impl->repeat_source is never NULL.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1839>
This commit is contained in:
Carlos Garnacho 2021-04-23 22:53:27 +02:00 committed by Marge Bot
parent 2337e0af8b
commit b4a7f35146

View File

@ -244,8 +244,10 @@ meta_seat_impl_clear_repeat_source (MetaSeatImpl *seat_impl)
if (seat_impl->repeat_source) if (seat_impl->repeat_source)
{ {
g_source_destroy (seat_impl->repeat_source); g_source_destroy (seat_impl->repeat_source);
g_clear_object (&seat_impl->repeat_device); g_clear_pointer (&seat_impl->repeat_source, g_source_unref);
} }
g_clear_object (&seat_impl->repeat_device);
} }
static void static void