Skip to content

Commit

Permalink
[plugin] fix: dispose deploy listener on close
Browse files Browse the repository at this point in the history
Signed-off-by: ensorrow <1121264060@qq.com>
  • Loading branch information
ensorrow authored and akosyakov committed Sep 18, 2019
1 parent 7ab689f commit 4991c24
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/plugin-ext/src/hosted/node/plugin-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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();
}
Expand All @@ -54,6 +56,7 @@ export class HostedPluginServerImpl implements HostedPluginServer {

dispose(): void {
this.hostedPlugin.clientClosed();
this.deployedListener.dispose();
}
setClient(client: HostedPluginClient): void {
this.client = client;
Expand Down

0 comments on commit 4991c24

Please sign in to comment.