From 81d85fb95d71c0d781328506f1417e7b92c68b97 Mon Sep 17 00:00:00 2001 From: Lyude Date: Thu, 4 May 2017 18:04:31 -0400 Subject: [PATCH xserver 10/12] xwayland: Unconditionally initialize lists in init_tablet_manager_seat() In the event that xwayland gets launched on a wayland compositor that doesn't yet have support for wp_tablet_manager, we end up skipping the initialization of the lists. This is wrong, because regardless of whether or not a tablet is present we still attempt to traverse these lists later in xwl_set_cursor(), expecting that if the lists are empty from no tablet manager that we simply won't execute any loop iterations. (EE) (EE) Backtrace: (EE) 0: Xwayland (OsSigHandler+0x3b) [0x4982f9] (EE) 1: /lib64/libpthread.so.0 (__restore_rt+0x0) [0x7f73722545bf] (EE) 2: Xwayland (xwl_set_cursor+0x9f) [0x429974] (EE) 3: Xwayland (miPointerUpdateSprite+0x261) [0x4fe1ca] (EE) 4: Xwayland (mieqProcessInputEvents+0x239) [0x4f8d33] (EE) 5: Xwayland (ProcessInputEvents+0x9) [0x4282f0] (EE) 6: Xwayland (Dispatch+0x42) [0x43e2d4] (EE) 7: Xwayland (dix_main+0x5c9) [0x44c6dc] (EE) 8: Xwayland (main+0x28) [0x61c523] (EE) 9: /lib64/libc.so.6 (__libc_start_main+0xf1) [0x7f7371e9d401] (EE) 10: Xwayland (_start+0x2a) [0x4208fa] (EE) 11: ? (?+0x2a) [0x2a] (EE) (EE) Segmentation fault at address 0x28 (EE) Fatal server error: (EE) Caught signal 11 (Segmentation fault). Server aborting (EE) Reproduced when trying to run upstream xwayland under fedora 25's weston package. Signed-off-by: Lyude Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer (cherry picked from commit a06bb73053d9df56d9070ce325a43af3a3c7a6a2) --- hw/xwayland/xwayland-input.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c index 8011b965c..ee932be60 100644 --- a/hw/xwayland/xwayland-input.c +++ b/hw/xwayland/xwayland-input.c @@ -2200,6 +2200,10 @@ static void init_tablet_manager_seat(struct xwl_screen *xwl_screen, struct xwl_seat *xwl_seat) { + xorg_list_init(&xwl_seat->tablets); + xorg_list_init(&xwl_seat->tablet_tools); + xorg_list_init(&xwl_seat->tablet_pads); + if (!xwl_screen->tablet_manager) return; @@ -2207,10 +2211,6 @@ init_tablet_manager_seat(struct xwl_screen *xwl_screen, zwp_tablet_manager_v2_get_tablet_seat(xwl_screen->tablet_manager, xwl_seat->seat); - xorg_list_init(&xwl_seat->tablets); - xorg_list_init(&xwl_seat->tablet_tools); - xorg_list_init(&xwl_seat->tablet_pads); - zwp_tablet_seat_v2_add_listener(xwl_seat->tablet_seat, &tablet_seat_listener, xwl_seat); } -- 2.13.5