Repository navigation
Freeze buf fix - #207
Merged
Merged
Freeze buf fix#207
Conversation
dafaqboomduck
marked this pull request as draft
April 10, 2026 09:21
dafaqboomduck
marked this pull request as ready for review
April 10, 2026 10:58
Collaborator
|
i don't think it's only xwayland app that cause this, because firefox also caused problem iirc |
That might be a different issue. I experience the whole COSMIC DE freezing sometimes and I never use xwayland. The screen does not respond anymore I have to long-press the power button to force shutdown. I experienced similar issue in pop-os/cosmic-screenshot#216. So this is not exactly "freezing other apps". Just to say there are more bugs out there that causes some kind of freezing. |
…cher and clipboard modules - **Graceful startup failure handling**: Replace `panic!` with `std::process::exit(1)` for critical startup errors in config and applet initialization - **Enhanced error recovery**: Introduce `RegistryInvalidId` and `OfferNotFound` error variants in `clipboard_watcher.rs`; replace `unwrap()` with `if let` patterns for seat lookups to prevent panics - **Fixed offer lifecycle**: `set_offer` and `set_primary_offer` now return old offers to avoid memory leaks; event handlers now clean up stale entries before updating - **Channel safety and error classification**: Replace `unwrap()` in `clipboard.rs` with graceful exits on channel closure; introduce `ClipboardMessage::ErrorRecoverable` and `ErrorFatal` variants, along with `is_recoverable()` method for structured error handling - **Removed pending hangs**: Eliminated `std::future::pending()` after errors to ensure consistent program termination - **App state updates**: `app.rs` now distinguishes between recoverable and fatal errors, logging and continuing for recoverable cases while updating state for fatal ones These changes ensure robust error handling, prevent process crashes, and maintain clean resource management across critical operations.
- Apply cargo fmt formatting to clipboard.rs and clipboard_watcher.rs - Add STABILITY_FIXES.md documenting all Phase 2 fixes and future work Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
dafaqboomduck
force-pushed
the
freeze_buf_fix
branch
from
October 25, 2026 09:08
27bf83c to
c87f26d
Compare
Contributor
Author
|
Fixed merge conflicts; @wiiznokes merge?
|
wiiznokes
enabled auto-merge (squash)
October 25, 2026 10:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Clipboard Manager Stability & Freeze Fixes
Fixes #186 — the clipboard manager freezing other applications (Chrome, Sublime Text, Zed, Firefox, Electron apps) under Wayland with XWayland.
Root cause analysis and fix strategy developed with assistance from Claude (Anthropic).
Freeze Fixes
X11 atom filtering (
clipboard_watcher.rs) — XWayland apps advertise X11 negotiation atoms (SAVE_TARGETS,TARGETS,MULTIPLE,TIMESTAMP,COMPOUND_TEXT) that poison Chrome/Electron's clipboard thread when requested. Added a blocklist to skip these before callingoffer.receive().Wayland queue flush (
clipboard_watcher.rs) —offer.receive()only buffers requests client-side. Withoutqueue.flush()afterward, the compositor never sees them, and pipes block forever. Added flush after the receive loop.Async concurrent pipe reads with timeout (
clipboard.rs,Cargo.toml) — Replaced synchronous sequentialpipe.read_to_end()(which blocked the entire async runtime) with concurrent async reads viatokio::net::unix::pipe::Receiver+futures::future::join_all, each wrapped in a 500mstokio::time::timeout. Total wall time is now capped at 500ms regardless of MIME type count.Error Handling Fixes
panic!()/unwrap()throughoutmain.rs,clipboard_watcher.rs, andclipboard.rswith graceful error handling and warning logsGlobalError::InvalidIdpanic ("How's this possible?") with proper error variantErrorRecoverablevsErrorFatal) so transient failures don't permanently kill the clipboardTesting
Tested on Pop!_OS 24.04 LTS with COSMIC. Copy/paste from XWayland apps (VS Code, Claude Desktop/Electron) works without freezes. Rapid stress testing is stable. Debug logs confirm atoms are filtered and no timeouts on well-behaved sources.