Skip to content

bug: libobs: OBS dies on Wayland with more than one seat (keyboard requested from the wrong seat) (upstream #12929) #243

Closed

Description

@rdoupe

Upstream OBS bug, reported by chronically-late in obsproject/obs-studio#12929 (first filed as obsproject/obs-studio#12237). Code unchanged in this fork.

Location

  • libobs/obs-nix-wayland.c:247: every wl_seat global overwrites plat->seat, so only the last seat bound is kept.
  • libobs/obs-nix-wayland.c:216: when any seat reports a keyboard, platform_seat_capabilities() calls wl_seat_get_keyboard(plat->seat), on that last seat rather than the seat that reported it. Line 219 releases the keyboard when any other seat reports no keyboard.
  • libobs/obs-nix-wayland.c:252: global_remove is ignored, so a seat removed at runtime is never released; on shutdown (line 297) only the last seat is released.

Class

Crash (fatal Wayland protocol error at startup), plus lost hotkey keyboard and leaked seats.

How it is reached

A compositor announces more than one seat, and the last one has no keyboard. The reporter runs sway with a second seat for a touchscreen and tablet. OBS asks that seat for a keyboard, and the compositor answers with wl_seat.missing_capability. A protocol error kills the whole connection, which OBS shares with Qt, so OBS exits at startup:

wl_seat#56: error 0: wl_seat.get_keyboard called when no keyboard capability has existed
warning: The Wayland connection experienced a fatal error: Protocol error

If the seat order is reversed, OBS starts, but the seat without a keyboard releases the keyboard taken from the other seat, so the Wayland hotkey key state never sees a key.

Reproduced without a display: the real obs-nix-wayland.c talks over a socketpair to a small fake compositor in a child process. The compositor announces several seats and enforces missing_capability.

Proposed fix and failing test

Fix: keep every bound seat with its registry name and capabilities. Request the keyboard from a seat that reports one. Release it only when that seat loses the keyboard or is removed, clearing held keys because no leave event follows. Then take another seat's keyboard if there is one. Release removed seats at runtime and all remaining seats on shutdown. This builds on kkartaltepe's upstream PR obsproject/obs-studio#12302, which the reporter and Sivecano confirmed stops the crash.

RED test (cmocka, test_wayland_multiseat) has six cases. 5 of 6 fail today; the single-seat control passes. With the fix, all 6 pass.

Activity

  1. rdoupe commented on Oct 11, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: this issue.

    1. RED: test_wayland_multiseat, a fake compositor with several seats (5 of 6 fail today).
    2. GREEN: take the keyboard from the seat that has one, track every seat, and hand over or release correctly on capability changes and seat removal.
      PR within the hour.
  2. rdoupe commented on Oct 11, 2026

    @rdoupe
    CollaboratorAuthor

    @chronically-late @Sivecano you reported or tested this in obsproject/obs-studio#12929 / #12237, so a heads-up: it's fixed here in obs-rust by #244, merged today with a regression test.

    Cause: OBS kept only the last wl_seat it bound, then asked that seat for a keyboard whenever any seat announced one. On a setup with a seat that has no keyboard (chronically-late's sway with a touchscreen and tablet), the compositor kills the connection OBS shares with Qt, which is the crash. OBS now tracks every seat, takes the keyboard from the seat that has one, keeps it when another seat has none, hands it to another seat when its own goes away (seat removed or keyboard unplugged, with held keys cleared), and releases every seat on shutdown.

    It builds on kkartaltepe's obsproject/obs-studio#12302 (credited as co-author), which you tested. Sivecano, your point that the multi-seat handling was still a mess is what the extra seat tracking addresses: against the new test, #12302 still leaked seats on shutdown and didn't hand the keyboard over when a seat was removed, and both now pass. The test runs OBS's Wayland code against a small fake compositor with several seats.

    Workaround on stock OBS: run it under XWayland (QT_QPA_PLATFORM=xcb obs), where hotkeys use X11 and the Wayland seat code isn't used.

    obs-rust is an AI-assisted fork of OBS; on Arch it's obs-studio-rust-git in the AUR.

    If you get a chance to try it on your multi-seat setup, a short reply here on whether OBS starts and hotkeys work would really help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions