Skip to content
  • Dima Ryazanov's avatar
    Fix a crash when unlocking or unconfining a pointer · e0dc5d47
    Dima Ryazanov authored and Pekka Paalanen's avatar Pekka Paalanen committed
    
    
    In GNOME (but not in Weston), if a window loses focus, the client first receives
    the focus event, then the unlock/unconfine event. This causes toytoolkit to
    dereference a NULL window when unlocking or unconfining the pointer.
    
    To repro:
    - Run weston-confine
    - Click the window
    - Alt-Tab away from it
    
    Result:
    
    [1606837.869] wl_keyboard@19.modifiers(63944, 524352, 0, 0, 0)
    [1606837.926] wl_keyboard@19.leave(63945, wl_surface@15)
    [1606837.945] wl_pointer@18.leave(63946, wl_surface@15)
    [1606837.956] wl_pointer@18.frame()
    [1606837.961] zwp_confined_pointer_v1@26.unconfined()
    Segmentation fault (core dumped)
    
    To fix this, get the input from the window instead of the other way around.
    
    Signed-off-by: default avatarDima Ryazanov <dima@gmail.com>
    Reviewed-by: default avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
    e0dc5d47