Repository navigation
Conversation
Clipboard history entries all showed "Unsupported format" in Quick Launch. Only get_history_items_async() ran on the MTA worker; the per-item get_text_async()/get_bitmap_async()/stream reads ran on the query worker (STA) thread, where winrt's blocking .get() raises "Cannot call blocking method from single-threaded apartment". The exception was swallowed, so every item fell through to the unknown-format branch. Run the whole history load and parse on the MTA worker, and log the previously swallowed read errors at debug level. Assisted-by: Claude Code <noreply@anthropic.com>
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.
Since v2.0.8, every entry in Quick Launch's clipboard history shows up as "Clipboard item – Unsupported format", even plain text, and there's no preview. Restoring an entry still works, and Win+V shows the same items fine.
Cause
This is a regression from a420194, which added
CoInitialize()toQueryWorkerso file search could use Windows Search. That turned the query worker into a single-threaded apartment (STA) thread, and winrt refuses blocking.get()calls on STA threads.The provider already worked around this for the history query by running it on a separate multi-threaded apartment (MTA) worker. But the items it returned were then read back on the query worker:
get_text_async().get(),get_bitmap_async().get()and the bitmap stream reads. Each of those raisedCannot call blocking method from single-threaded apartment. A bareexcept: passswallowed the error, so every item fell through to the unknown-format branch. Restore kept working becauseset_history_item_as_contentdoesn't block.Fix
The whole load (the history query and the per-item parsing) now runs on the MTA worker, so the provider works no matter which apartment its caller is in. The two read errors that were silently swallowed are now logged at debug level, so a failure like this is easier to spot.
I tested this by running yasb from source, and all tests pass apart from
tests/bar/test_adaptive_bar.py, which fails the same way on main.Assisted-by: Claude Code noreply@anthropic.com