Skip to content

Handle Wayland capture stream failures - #2165

Merged
CendioHalim merged 2 commits into
TigerVNC:masterfrom
yeager:fix-wayland-capture-stream-failures
Oct 23, 2026
Merged

CendioHalim merged 2 commits into
TigerVNC:masterfrom
yeager:fix-wayland-capture-stream-failures

Conversation

@yeager

@yeager yeager commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Treat a PipeWire stream entering UNCONNECTED as a failed capture session, log it at error level, and stop serving clients with stale frames.
  • Preserve the last advertised Wayland shm formats when a session sends another done without repeating the format events.
  • Keep failure of the optional pointer cursor capture from closing the main desktop session.
  • Reject invalid or oversized compositor-provided buffer dimensions before allocation, and stop the capture session if resizing the shared memory file fails.

Fixes #2144 and addresses the silent freeze in #2154 by surfacing the disconnect and closing connected clients.

Verification

  • git diff --check
  • Built w0vncserver on Ubuntu 24.04 against this branch; build completed and --version ran successfully.
  • GitHub Linux build and unit tests passed on the previous commit; the updated commit's workflow is running.

@CendioHalim CendioHalim left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for taking so long before looking at this.

I'll see if I can do a test-run on the setup I had where this failed later today.

While I was looking, I noticed that we missed a null check in ~ImageCopyCaptureSession() when session is destroyed. Would you mind adding that while you're at it?

And thank you for the fixes, much appreciated!

@CendioHalim

Copy link
Copy Markdown
Contributor

Confirmed that this fixes the issue in #2144.

Could you rebase this branch so that the last commit with the fixes are part of their respective commit?

@yeager
yeager force-pushed the fix-wayland-capture-stream-failures branch 2 times, most recently from 325edde to e14b316 Compare October 22, 2026 15:15
@yeager

yeager commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto current master and force-pushed the two commits.

The destructor null check has already landed in master as a55e073, so it now comes from the base branch rather than being duplicated in this PR. The buffer-size validation remains in the second commit.

Validation: the rebased w0vncserver build completed on a Linux Wayland/PipeWire host. I also started it as the active GDM Wayland-session user with localhost-only RFB and completed the protocol path through desktop startup. That host has only the GDM greeter session, not an accessible user desktop, so RemoteDesktop correctly refused to capture a session and no framebuffer was read.

Gitleaks found no leaks in the rebased two-commit range.

@CendioHalim
CendioHalim force-pushed the fix-wayland-capture-stream-failures branch from e14b316 to 90f1b31 Compare October 23, 2026 14:09
@CendioHalim
CendioHalim force-pushed the fix-wayland-capture-stream-failures branch from 90f1b31 to 3d894e8 Compare October 23, 2026 14:10
@CendioHalim
CendioHalim merged commit ed951a4 into TigerVNC:master Oct 23, 2026
14 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ImageCopyCaptureSession broken on labwc

2 participants