fix(windows): replace native scanner with fs scan to fix Segfault (#592) - #620
Open
derekxia1988 wants to merge 1 commit into
Open
fix(windows): replace native scanner with fs scan to fix Segfault (#592)#620derekxia1988 wants to merge 1 commit into
derekxia1988 wants to merge 1 commit into
Conversation
…oolsCenter#592) ztools_native.node's scanWindowsShortcuts Segfaults in the Electron main process on Windows systems where the desktop folder is redirected to a path containing non-ASCII characters (e.g. OneDrive/桌面). The crash bypasses try/catch and is suspected to be a conflict between uiohook-napi and the native module's Win32 API calls. Replace WindowsShortcutScanner.scan() with fs.readdirSync recursion over .lnk files. No native module is called, so the crash cannot occur. Known regressions vs. the native implementation: - .url shortcuts in Start Menu are not shown - desktop.ini localized names are not resolved (shows file basename) - .lnk target paths are not resolved (deduplication falls back to .lnk path) Fixes ZToolsCenter#592
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
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.
问题
关闭 #592。
ztools_native.node的scanWindowsShortcuts在以下条件下于 Electron 主进程中 Segfault:桌面)uiohook-napi全局键盘钩子已在DoubleTapManager中启动Segfault 发生在 native 层,无法被 JS
try/catch捕获,导致进程直接退出(exit code 139)。已确认:在纯 Node.js 环境中以相同参数调用不会崩溃;仅在 Electron 主进程中复现。
修复
将
windowsScanner.ts中的WindowsShortcutScanner.scan()替换为fs.readdirSync递归扫描.lnk文件,不调用 native 模块,从根本上消除崩溃路径。已知差异(相比原生实现)
.lnk快捷方式.url快捷方式desktop.ini本地化名称.lnk目标路径解析(用于去重)复现环境
C:\Users\YX\OneDrive\桌面🤖 Generated with Claude Code