diff --git a/electron/core/plugins/inference-plugin/index.js b/electron/core/plugins/inference-plugin/index.js index 6c001d9d2..9f9ec36cc 100644 --- a/electron/core/plugins/inference-plugin/index.js +++ b/electron/core/plugins/inference-plugin/index.js @@ -13,7 +13,7 @@ const dispose = async () => new Promise(async (resolve) => { if (window.electronAPI) { window.electronAPI - .invokePluginFunc(MODULE_PATH, "killSubprocess") + .invokePluginFunc(MODULE_PATH, "dispose") .then((res) => resolve(res)); } }); diff --git a/electron/core/plugins/inference-plugin/module.js b/electron/core/plugins/inference-plugin/module.js index 44205277b..c4da0f627 100644 --- a/electron/core/plugins/inference-plugin/module.js +++ b/electron/core/plugins/inference-plugin/module.js @@ -72,6 +72,11 @@ async function initModel(product) { } function dispose() { + killSubprocess(); + // clean other registered resources here +} + +function killSubprocess() { if (subprocess) { subprocess.kill(); subprocess = null; @@ -83,5 +88,6 @@ function dispose() { module.exports = { initModel, + killSubprocess, dispose, };