[PATCH xserver] xwayland: Make sure we have a focus window
Peter Hutterer
peter.hutterer at who-t.net
Wed Mar 1 04:21:18 UTC 2017
On Tue, Feb 28, 2017 at 02:27:52PM +0100, Olivier Fourdan wrote:
> During the InitInput() phase, the wayland events get dequeued so we
> can possibly end up calling dispatch_pointer_motion_event().
>
> If this occurs before xwl_seat->focus_window is set, it leads to a NULL
> pointer derefence and a segfault.
>
> Check for xwl_seat->focus_window in both pointer_handle_frame() and
> relative_pointer_handle_relative_motion() prior to calling
> dispatch_pointer_motion_event() like it's done in
> pointer_handle_motion().
>
> Bugzilla: https://bugzilla.redhat.com/1410804
> Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
remote: Updating patchwork state for https://patchwork.freedesktop.org/project/Xorg/list/
remote: I: patch #141238 updated using rev 8c9909a99292b2fb4a86de694bb0029f61e35662.
remote: I: 1 patch(es) updated to state Accepted.
To git+ssh://git.freedesktop.org/git/xorg/xserver
c9cbdad..8c9909a master -> master
Cheers,
Peter
> ---
> hw/xwayland/xwayland-input.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
> index 8435da0..9c1581f 100644
> --- a/hw/xwayland/xwayland-input.c
> +++ b/hw/xwayland/xwayland-input.c
> @@ -510,6 +510,9 @@ pointer_handle_frame(void *data, struct wl_pointer *wl_pointer)
> {
> struct xwl_seat *xwl_seat = data;
>
> + if (!xwl_seat->focus_window)
> + return;
> +
> dispatch_pointer_motion_event(xwl_seat);
> }
>
> @@ -560,6 +563,9 @@ relative_pointer_handle_relative_motion(void *data,
> xwl_seat->pending_pointer_event.dx_unaccel = wl_fixed_to_double(dx_unaccelf);
> xwl_seat->pending_pointer_event.dy_unaccel = wl_fixed_to_double(dy_unaccelf);
>
> + if (!xwl_seat->focus_window)
> + return;
> +
> if (wl_proxy_get_version((struct wl_proxy *) xwl_seat->wl_pointer) < 5)
> dispatch_pointer_motion_event(xwl_seat);
> }
> --
> 2.9.3
>
More information about the xorg-devel
mailing list