Closed jehillert closed 4 years ago
I've never heard or seen that :-(. Is there any log for that ?
I tried to recreate it again in linux mint. It happened, then stopped happening after I toggled the theme on and off a little bit. Regardless, here is the log when it broke. Anything in there look helpful? If not, I can poke around the Sublime on my Windows boot next week and see if I can get something more helpful for you.
Traceback (most recent call last):
File "/opt/sublime_text/sublime_plugin.py", line 627, in on_activated_async
callback.on_activated_async(v)
File "C:\Users\pouco\AppData\Roaming\Sublime Text 3\Packages\Guna\core\engine.py", line 984, in on_activated_async
File "C:\Users\pouco\AppData\Roaming\Sublime Text 3\Packages\Guna\core\engine.py", line 984, in <genexpr>
AttributeError: 'NoneType' object has no attribute 'endswith'
font face "Roboto Condensed" could not be found, defaulting to "Monospace"
reloading settings Packages/User/Preferences.sublime-settings
reloading settings Packages/User/Preferences.sublime-settings
reloading settings Packages/User/Preferences.sublime-settings
reloading settings Packages/User/Preferences.sublime-settings
...actually, that's weird. Why is it saying "C:\Users\pouco\Appdata"? That's not a directory on my computer.
The log above doesn't look like a crash log. When I testing, (open project, switch project, ...), sometimes Sublime suddenly quits and generates .dmp file, but it is hard to reproduce it. In the sublime forum, there are many crash reports related with project. - https://forum.sublimetext.com/search?q=crash%20project. I'm not sure it is Guna's problem. Could you summarize crash situation to reproduce in my computer ? Save Project > Close Project > Open Project ?
I think this issue is caused by a race condition, which can happen if a file is quickly opened and closed in a transient view.
If the view gets closed while the asynchronous event handler on_activated_async()
loops trough any(view.file_name().endswith(p) for p in lock_file_path)
the exception above is raised.
The reason is calling view.file_name()
repetitively in the loop.
The current code is:
def on_activated_async(self, view):
if isinstance(view.file_name(), str):
if any(view.file_name().endswith(p) for p in lock_file_path):
view.set_read_only(True)
check_status(prefs=None, view=view)
return
To avoid that issue, you should cache the file name read via API. It would also reduce the number of API calls for better runtime efficiency. The view.file_name()
always returns None
or a string
. So the isinstance()
may not be needed as well.
def on_activated_async(self, view):
file_name = view.file_name()
if file_name:
if any(file_name.endswith(p) for p in lock_file_path):
view.set_read_only(True)
check_status(prefs=None, view=view)
return
Just familiar with python's byte code ;-)
I did not see anything about this in the docs or in the other issue reports, so forgive me if this is a known side effect, or there's a reason for this behavior that is intentional. For the last two or three years, I have noticed Sublime shut down immediately every time I try to open it without an active project preloaded. If I closed the last project I was working on via "close project" (as opposed to a hot exit), then next time I try to open the app as a single blank file, Sublime instantly closes. And then continues on doing so until I eventually open it as a project file, a workspace file, or (if I recall) from a folder.
I remember thinking at some point that Sublime did not behave like this when I first got it. But I could not recall that anything had changed and the behavior had followed me across operating systems (Windows 10, Ubuntu, Mint, and back to Windows). It was consistent, so I chalked it up to some weird quirk of Sublime.
But one thing I forgot to take into account is I have been using Guna almost religiously during that same time. Today, as I was reinstalling Sublime back on Windows (I am hard on my OS's), I finally noticed that adding Guna is what causes the issue, at least in combination with my other settings.
In the event that this is a new issue, I am pasting the state my system settings here, or at least the list of apps I had installed and my default settings that the error occurred in. If that does not trigger it for you, just let me know what other information would be helpful and I will send it your way.
Package Control.sublime-settings (I had just added these apps in small batches so they would not error out. They seemed to work fine out of the above-referenced context):
And here are my settings, without Guna. They seemed to not cause any issues on their own.:
I thought maybe color scheme and theme had to match, but swapping the following line out for the other color scheme above did not cause a problem.
But adding the following theme line did cause the problem consistently: