Repository navigation
fix(linux): close Wayland sharing sessions after capture - #3986
Conversation
|
@AksharP5 is attempting to deploy a commit to the Cap Software Inc Team on Vercel. A member of the Team first needs to authorize it. |
|
Merged current main into this branch and verified it on Ubuntu 24.04 (x86_64). Reproduced on main (218b056). I ran this PR's On this branch (5354374)
Lifecycle check. The close task registers a scope completion, and Not covered. I couldn't run a real compositor cast. Headless sway 1.9 with xdg-desktop-portal-wlr 0.7.1 creates the session, but Start fails with "unable to receive a valid format from wlr_screencopy" (pixman headless, nested X11, and GLES on vgem all failed), even though grim captures that output fine. |
|
hey @greptileai, please re-review the PR |
Cap does not explicitly close its ScreenCast portal session when Wayland capture ends. On backends that retain it after the PipeWire consumer disconnects, repeated attempts can accumulate sessions until Cap exits. The shared D-Bus connection remains alive for the process lifetime.
Register session cleanup immediately after acquisition, using the existing pipeline cleanup scope. Drop of the capture owner releases the worker to close the portal session; the lifecycle waits for its acknowledgement. Real close failures keep cleanup unconfirmed, while an already-removed session counts as closed. Startup cancellation and fd-open errors use the same ownership path.
The regression runs the actual acquisition/owner and cleanup scope against a private D-Bus service. A Unix socket pair represents the remote fd; no compositor or PipeWire daemon is used.
Validation: the actual native regression passes all seven private-bus child cases, and the full cap-recording library suite passes 948 tests with 14 ignored. The unchanged production-source negative control leaves two sessions open. Three additional isolated probes pass for an unresponsive Close timeout, cleanup outside a scope, and a scope waiting while the capture owner remains alive. Full locked crate checking, formatting and workflow parsing pass. Strict Clippy on host Rust 1.99.1 reports the same 21 pre-existing errors on baseline and patch. Linux CI already runs the recording library suite; setup now explicitly installs dbus-daemon for this test.
No real compositor recording, installed Omarchy session or sharing-indicator appearance was exercised. Retained session resources/indicators are supported by protocol and GNOME source tracing, not a native visual reproduction. This does not claim that recording continues after Stop.
Closes #3985


Confidence Score: 5/5
The PR appears safe to merge; no blocking issues were found.Summary
This PR closes Wayland sharing sessions when their capture owner is dropped.
No actionable new issues were found. No previous review threads were supplied. The previous-review range was not used because the merge bases differ. Tests were not run during this review.
Reviews (2) · Last reviewed commit: "Merge origin/main into close-wayland-ses..." · Reviewed by Greptile