v0.3.7: 全面代码审计修复 - 20项Bug/安全/稳定性改进

This commit is contained in:
thzxx
2026-06-15 15:02:38 +08:00
parent c0e16f2885
commit dd78ff15a9
20 changed files with 158 additions and 67 deletions
+4 -2
View File
@@ -66,10 +66,12 @@ export function registerIpcHandlers(
const win = getMainWindow()
try {
if (data.filePath) {
fileWatcher.stop()
// Mark self-writing before stopping watcher to suppress any events
// that arrive between stop and start
fileWatcher.setSelfWriting(true)
fileWatcher.stop()
const result = await saveFileContent(data.filePath, data.content)
// start watcher while selfWriting is still true so any immediate 'change'
// Restart watcher while selfWriting is still true so any immediate 'change'
// event from the restart is suppressed — prevents overwriting editor content
fileWatcher.start(data.filePath)
fileWatcher.setSelfWriting(false)