Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Safely call kernel.destroy (#18085)

Jeffrey Chen669f02ec4431
diff --git a/app/src/plugin/uninstall.ts b/app/src/plugin/uninstall.ts
index 9cce4b4c4f..34f0d56c3f 100644
--- a/app/src/plugin/uninstall.ts
+++ b/app/src/plugin/uninstall.ts
@@ -21,7 +21,11 @@ export const uninstall = (app: App, name: string, isReload: boolean) => {
} catch (e) {
console.error(`plugin ${plugin.name} onunload error:`, e);
}
- plugin.kernel.destroy();
+ try {
+ plugin.kernel.destroy();
+ } catch (e) {
+ console.error(`plugin ${plugin.name} kernel destroy error:`, e);
+ }
if (!isReload) {
try {
plugin.uninstall();
diff --git a/app/src/window/closeWin.ts b/app/src/window/closeWin.ts
index aa419b1cca..c2027560d6 100644
--- a/app/src/window/closeWin.ts
+++ b/app/src/window/closeWin.ts
@@ -7,10 +7,10 @@ export const closeWindow = async (app: App) => {
const plugin = app.plugins[i];
try {
await plugin.onunload();
+ await plugin.kernel.destroy();
} catch (e) {
console.error(e);
}
- await plugin.kernel.destroy();
}
ipcRenderer.send(Constants.SIYUAN_CMD, "destroy");
};