Skip to content

Fix race condition leading to AttributeError#70

Open
giampaolo wants to merge 1 commit intoaziz:masterfrom
giampaolo:fix-attribute-err
Open

Fix race condition leading to AttributeError#70
giampaolo wants to merge 1 commit intoaziz:masterfrom
giampaolo:fix-attribute-err

Conversation

@giampaolo
Copy link
Copy Markdown

Hello @aziz.

I've seen this error multiple times over the months (years?), without ever being able to come up with a reproducing test case. It just shows up from time to time. Long story short: these 2 lines check whether window is not None:
https://github.com/aziz/SublimeANSI/blob/master/ansi.py#L373-L374.
Window may not be None at line 373, but it can turn to None at lines 375 and 377 (this is the race condition). The error that can be seen in ST console is:

  File "/home/giampaolo/.config/sublime-text/Installed Packages/ANSIescape.sublime-package/ansi.py", line 343, in check_left_ansi
    if not self._is_view_valid(view):
  File "/home/giampaolo/.config/sublime-text/Installed Packages/ANSIescape.sublime-package/ansi.py", line 377, in _is_view_valid
    if view not in view.window().views():
AttributeError: 'NoneType' object has no attribute 'views'

Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
@giampaolo
Copy link
Copy Markdown
Author

I now realize this is a very old issue for which a solution has been proposed already (but unfortunately no merge):
#43
#12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant