v0.3.7: 全面代码审计修复 - 20项Bug/安全/稳定性改进
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user