sublimelsp / LSP

Client implementation of the Language Server Protocol for Sublime Text
https://lsp.sublimetext.io/
MIT License
1.66k stars 183 forks source link

Exception on setting change #2554

Closed rchl closed 1 week ago

rchl commented 1 week ago

Got this one on changing a setting and closing a window:

Traceback (most recent call last):
  File "/Users/rafal/Library/Application Support/Sublime Text/Packages/LSP/plugin/core/windows.py", line 567, in _on_userprefs_updated_async
    for wm in self._windows.values():
RuntimeError: dictionary changed size during iteration

self._windows must have changed from the main thread while this code was running.

jwortmann commented 1 week ago

It looks that self._windows gets modified from the main thread via https://github.com/sublimelsp/LSP/blob/2f37a49968c4591b0df9814561f65890cedb70ed/boot.py#L226-L227 which calls https://github.com/sublimelsp/LSP/blob/2f37a49968c4591b0df9814561f65890cedb70ed/plugin/core/windows.py#L561-L562

So it should not be iterated on the async thread. Should be easy to fix.