@@ -2,6 +2,7 @@ import { inject, injectable } from 'inversify';
22import { EventEmitter } from 'vscode' ;
33
44import { IEncryptedStorage } from '../../../platform/common/application/types' ;
5+ import { IAsyncDisposableRegistry } from '../../../platform/common/types' ;
56import { logger } from '../../../platform/logging' ;
67import { IntegrationConfig , IntegrationType } from './integrationTypes' ;
78
@@ -22,7 +23,13 @@ export class IntegrationStorage {
2223
2324 public readonly onDidChangeIntegrations = this . _onDidChangeIntegrations . event ;
2425
25- constructor ( @inject ( IEncryptedStorage ) private readonly encryptedStorage : IEncryptedStorage ) { }
26+ constructor (
27+ @inject ( IEncryptedStorage ) private readonly encryptedStorage : IEncryptedStorage ,
28+ @inject ( IAsyncDisposableRegistry ) asyncRegistry : IAsyncDisposableRegistry
29+ ) {
30+ // Register for disposal when the extension deactivates
31+ asyncRegistry . push ( this ) ;
32+ }
2633
2734 /**
2835 * Get all stored integration configurations
@@ -168,4 +175,11 @@ export class IntegrationStorage {
168175 const indexJson = JSON . stringify ( integrationIds ) ;
169176 await this . encryptedStorage . store ( INTEGRATION_SERVICE_NAME , 'index' , indexJson ) ;
170177 }
178+
179+ /**
180+ * Dispose of resources to prevent memory leaks
181+ */
182+ public dispose ( ) : void {
183+ this . _onDidChangeIntegrations . dispose ( ) ;
184+ }
171185}
0 commit comments