Skip to content

Commit 669f02e

Browse files
authored
🎨 Safely call kernel.destroy (#18085)
1 parent 0ce9467 commit 669f02e

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

app/src/plugin/uninstall.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ export const uninstall = (app: App, name: string, isReload: boolean) => {
2121
} catch (e) {
2222
console.error(`plugin ${plugin.name} onunload error:`, e);
2323
}
24-
plugin.kernel.destroy();
24+
try {
25+
plugin.kernel.destroy();
26+
} catch (e) {
27+
console.error(`plugin ${plugin.name} kernel destroy error:`, e);
28+
}
2529
if (!isReload) {
2630
try {
2731
plugin.uninstall();

app/src/window/closeWin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ export const closeWindow = async (app: App) => {
77
const plugin = app.plugins[i];
88
try {
99
await plugin.onunload();
10+
await plugin.kernel.destroy();
1011
} catch (e) {
1112
console.error(e);
1213
}
13-
await plugin.kernel.destroy();
1414
}
1515
ipcRenderer.send(Constants.SIYUAN_CMD, "destroy");
1616
};

0 commit comments

Comments
 (0)