From 5945942acd7aa8497f65212949767e055eeef42c Mon Sep 17 00:00:00 2001 From: xuncha <1658671838@qq.com> Date: Thu, 5 Mar 2026 14:43:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Ddev=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E8=BF=98=E6=9C=89=E8=BF=9B=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/main.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/electron/main.ts b/electron/main.ts index 4ec00b7..b91f2ad 100644 --- a/electron/main.ts +++ b/electron/main.ts @@ -2372,6 +2372,13 @@ app.whenReady().then(async () => { }) }) +app.on('before-quit', async () => { + // 停止 HTTP 服务器,释放 TCP 端口占用,避免进程无法退出 + try { await httpService.stop() } catch {} + // 终止 wcdb Worker 线程,避免线程阻止进程退出 + try { wcdbService.shutdown() } catch {} +}) + app.on('window-all-closed', () => { if (process.platform !== 'darwin') { app.quit()