• Alexandros Frantzis's avatar
    winewayland.drv: Ensure Wayland surface handlers don't access invalid data. · a7ec328f
    Alexandros Frantzis authored
    In our setup with a dedicated event dispatch thread, libwayland ensures
    that object proxies associated with an event handler remain valid (or
    NULL) while the handler is executing. However, no such guarantees are
    given for the proxy user data. It is thus possible for the user data to
    become invalid (e.g., its memory freed from a different thread) right
    after the event handler is entered.
    
    This is an issue for wayland_surface associated proxies since they may
    receive unsolicited events from the compositor at any time (e.g.,
    xdg_surface.configure), even while we are destroying the
    wayland_surface.
    
    To avoid the problem, we introduce a lock that protects access
    to xdg_surface user data and ensures that the associated wayland_surface
    remains valid for the duration of the handler.
    Co-authored-by: 's avatarRémi Bernon <rbernon@codeweavers.com>
    a7ec328f
wayland_surface.c 5.49 KB