Skip to content

fix(windows): 收敛 clipboard restore 并发恢复竞态#179

Merged
appergb merged 1 commit into
mainfrom
fix/issue-167-clipboard-restore-queue
May 2, 2026
Merged

fix(windows): 收敛 clipboard restore 并发恢复竞态#179
appergb merged 1 commit into
mainfrom
fix/issue-167-clipboard-restore-queue

Conversation

@appergb
Copy link
Copy Markdown
Collaborator

@appergb appergb commented May 2, 2026

摘要

Closes #167

把 Windows/Linux 路径里的“恢复用户原剪贴板”从无界多线程改成单条最新恢复链:连续多次听写时,只允许最新一轮 restore 真正落地,但保留最早那份原始剪贴板快照。

改动

  • schedule_clipboard_restore 改为分配递增 restore_id
  • 用进程级 PENDING_CLIPBOARD_RESTORE 记录“当前批次的最早原始剪贴板 + 最新 restore id”
  • 旧 restore 线程睡醒后若发现自己不是最新批次,直接退出,不再写系统剪贴板
  • 最新批次仍保留现有保护:只有剪贴板内容还等于最后一次插入文本时才恢复

验证

  • cargo check --manifest-path src-tauri/Cargo.toml
  • 最终 Windows 时序由 CI / 实机验证

@codex review

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Sorry @appergb, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@appergb appergb merged commit 9510611 into main May 2, 2026
2 checks passed
@appergb appergb deleted the fix/issue-167-clipboard-restore-queue branch May 2, 2026 03:49
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.

[windows] 快速连续听写时 clipboard restore 用错上一次的 previous_text

1 participant