Conversation
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.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.
fix: 修复 Tauri RPC 子进程死锁及窗口关闭后 QTimer RuntimeError
改动内容
包含 3 个 commit,解决两个问题:
1. Tauri RPC 子线程 stdin 死锁(f9022bd)
Rust 子线程通过
std::io::stdin()读取 RPC 响应时,与主线程BufReader共用同一 fd 0,触发全局内部 Mutex 死锁。
修复: Python 侧创建独立 pipe 作为 RPC 响应通道,通过
SAKURA_RPC_RESPONSE_FD环境变量传递给子进程;Rust 侧从该 fd 读取响应,绕过 stdin 的全局锁。
涉及文件:
app/ui/tauri_settings.py— 新增 pipe 创建、异常安全清理、写入通道切换tools/settings-tauri/src-tauri/src/lib.rs— 新增#[cfg(unix)]分叉读取逻辑,移除
#[cfg(not(unix))]中的内部重复 BufReadermain.py— 新增socks://→socks5://代理 scheme 规范化2. QTimer.singleShot 窗口关闭后触发 RuntimeError(57af702)
QTimer.singleShot(delay, callback)在窗口销毁后仍会触发回调,此时访问已销毁的QObject 会抛出 RuntimeError。
修复: 改为三参数形式
QTimer.singleShot(delay, self, callback),将 QTimer的生命周期绑定到 receiver 对象,窗口关闭后自动取消未触发的定时器。
涉及文件:
app/ui/tauri_settings.py兼容性
SAKURA_RPC_RESPONSE_FD环境变量仅内部使用,不影响用户配置