File tree Expand file tree Collapse file tree
com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/completion Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -162,8 +162,21 @@ public RenderManager getOrCreateNesRenderManager(ITextEditor editor) {
162162 return null ;
163163 }
164164
165- return nesRenderManagers .computeIfAbsent (editor ,
166- ed -> new RenderManager (this .languageServer , this .nesProvider , ed ));
165+ // Avoid computeIfAbsent() here: the RenderManager constructor calls
166+ // Display.syncExec() via registerListeners(), and computeIfAbsent() holds
167+ // an internal bucket lock during the mapping function. If the UI thread
168+ // concurrently calls remove() on the same bucket, both threads deadlock.
169+ // See https://github.com/microsoft/copilot-for-eclipse/issues/175
170+ RenderManager mgr = nesRenderManagers .get (editor );
171+ if (mgr == null ) {
172+ mgr = new RenderManager (this .languageServer , this .nesProvider , editor );
173+ RenderManager existing = nesRenderManagers .putIfAbsent (editor , mgr );
174+ if (existing != null ) {
175+ mgr .dispose ();
176+ mgr = existing ;
177+ }
178+ }
179+ return mgr ;
167180 }
168181
169182 /**
You can’t perform that action at this time.
0 commit comments