From 5af6a909734a2fad203fa143170da69701fd19f1 Mon Sep 17 00:00:00 2001 From: ensorrow <1121264060@qq.com> Date: Tue, 17 Sep 2019 14:38:45 +0800 Subject: [PATCH] [plugin] fix: dispose deploy listener on close Signed-off-by: ensorrow <1121264060@qq.com> --- packages/plugin-ext/src/hosted/node/plugin-service.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/plugin-ext/src/hosted/node/plugin-service.ts b/packages/plugin-ext/src/hosted/node/plugin-service.ts index 16645de07191c..e39cdfac9f9c0 100644 --- a/packages/plugin-ext/src/hosted/node/plugin-service.ts +++ b/packages/plugin-ext/src/hosted/node/plugin-service.ts @@ -16,7 +16,7 @@ import { injectable, inject, named, postConstruct } from 'inversify'; import { HostedPluginServer, HostedPluginClient, PluginMetadata, PluginDeployer } from '../../common/plugin-protocol'; import { HostedPluginSupport } from './hosted-plugin'; -import { ILogger } from '@theia/core'; +import { ILogger, Disposable } from '@theia/core'; import { ContributionProvider } from '@theia/core'; import { ExtPluginApiProvider, ExtPluginApi } from '../../common/plugin-ext-api-contribution'; import { HostedPluginDeployerHandler } from './hosted-plugin-deployer-handler'; @@ -39,13 +39,15 @@ export class HostedPluginServerImpl implements HostedPluginServer { protected client: HostedPluginClient | undefined; + protected deployedListener: Disposable; + constructor( @inject(HostedPluginSupport) private readonly hostedPlugin: HostedPluginSupport) { } @postConstruct() protected init(): void { - this.pluginDeployer.onDidDeploy(() => { + this.deployedListener = this.pluginDeployer.onDidDeploy(() => { if (this.client) { this.client.onDidDeploy(); } @@ -54,6 +56,7 @@ export class HostedPluginServerImpl implements HostedPluginServer { dispose(): void { this.hostedPlugin.clientClosed(); + this.deployedListener.dispose(); } setClient(client: HostedPluginClient): void { this.client = client;