[PATCH weston] input: Stop leaking libinput event source on session deactivation

Derek Foreman derekf at osg.samsung.com
Tue Jul 25 21:49:52 UTC 2017


On 2017-07-25 04:39 PM, Derek Foreman wrote:
> This is easily noticed as a leaked fd on every VC switch.
> 
> Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
> ---
>   libweston/libinput-seat.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/libweston/libinput-seat.c b/libweston/libinput-seat.c
> index 8cf5666b..953f6205 100644
> --- a/libweston/libinput-seat.c
> +++ b/libweston/libinput-seat.c
> @@ -134,6 +134,8 @@ udev_input_disable(struct udev_input *input)
>   	if (input->suspended)
>   		return;
>   
> +	wl_event_source_remove(input->libinput_source);
> +	input->libinput_source = NULL;

Actually having second thoughts about this - can this fd ever change on 
us?  Or can we just keep the event source we added in the first call to 
udev_input_enable forever?

Peter - can you school me on libinput usage here?

Thanks,
Derek

>   	libinput_suspend(input->libinput);
>   	process_events(input);
>   	input->suspended = 1;
> @@ -337,7 +339,8 @@ udev_input_destroy(struct udev_input *input)
>   {
>   	struct udev_seat *seat, *next;
>   
> -	wl_event_source_remove(input->libinput_source);
> +	if (input->libinput_source)
> +		wl_event_source_remove(input->libinput_source);
>   	wl_list_for_each_safe(seat, next, &input->compositor->seat_list, base.link)
>   		udev_seat_destroy(seat);
>   	libinput_unref(input->libinput);
> 



More information about the wayland-devel mailing list