From 1249ee9510017f6465899441acc863ea0a3e90e7 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Tue, 12 Nov 2024 14:08:26 -0800 Subject: [PATCH] Ensure native finder is disposed correctly --- .../base/locators/common/nativePythonFinder.ts | 3 +++ src/client/pythonEnvironments/index.ts | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/client/pythonEnvironments/base/locators/common/nativePythonFinder.ts b/src/client/pythonEnvironments/base/locators/common/nativePythonFinder.ts index 5dfe46fd7e90..a084cc1e4a16 100644 --- a/src/client/pythonEnvironments/base/locators/common/nativePythonFinder.ts +++ b/src/client/pythonEnvironments/base/locators/common/nativePythonFinder.ts @@ -463,6 +463,9 @@ export function getNativePythonFinder(context?: IExtensionContext): NativePython if (!_finder) { const cacheDirectory = context ? getCacheDirectory(context) : undefined; _finder = new NativePythonFinderImpl(cacheDirectory); + if (context) { + context.subscriptions.push(_finder); + } } return _finder; } diff --git a/src/client/pythonEnvironments/index.ts b/src/client/pythonEnvironments/index.ts index 2c6555d62024..f9613ee4847b 100644 --- a/src/client/pythonEnvironments/index.ts +++ b/src/client/pythonEnvironments/index.ts @@ -60,7 +60,6 @@ export async function initialize(ext: ExtensionState): Promise { if (shouldUseNativeLocator()) { const finder = getNativePythonFinder(ext.context); - ext.disposables.push(finder); const api = createNativeEnvironmentsApi(finder); ext.disposables.push(api); registerNewDiscoveryForIOC(