Skip to content

Commit 89fbfc2

Browse files
Fix race condition in unregistering authentication providers (microsoft#250667)
A minimal change for endgame.
1 parent 75ea573 commit 89fbfc2

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

extensions/github-authentication/src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export function activate(context: vscode.ExtensionContext) {
6969

7070
let before = vscode.workspace.getConfiguration().get<string>('github-enterprise.uri');
7171
let githubEnterpriseAuthProvider = initGHES(context, uriHandler);
72-
context.subscriptions.push(vscode.workspace.onDidChangeConfiguration(async e => {
72+
context.subscriptions.push(vscode.workspace.onDidChangeConfiguration(e => {
7373
if (e.affectsConfiguration('github-enterprise.uri')) {
7474
const after = vscode.workspace.getConfiguration().get<string>('github-enterprise.uri');
7575
if (before !== after) {

src/vs/workbench/api/common/extHostAuthentication.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,17 @@ export class ExtHostAuthentication implements ExtHostAuthenticationShape {
160160
return Promise.resolve();
161161
}
162162

163+
// Today, this only handles unregistering extensions that have disposables...
164+
// so basiscally just the dynmaic ones. This was done to fix a bug where
165+
// there was a racecondition between this event and re-registering a provider
166+
// with the same id. (https://github.com/microsoft/vscode-copilot/issues/18045)
167+
// This works for now, but should be cleaned up so theres one flow for register/unregister
163168
$onDidUnregisterAuthenticationProvider(id: string): Promise<void> {
164169
const providerData = this._authenticationProviders.get(id);
165170
if (providerData?.disposable) {
166171
providerData.disposable.dispose();
172+
this._authenticationProviders.delete(id);
167173
}
168-
this._authenticationProviders.delete(id);
169174
return Promise.resolve();
170175
}
171176

0 commit comments

Comments
 (0)