I've been trying to debug this issue for few minutes and when I thought I had "fixed" it's hitting me back again. Here's the thing, I'm keeping Sublime.view instances into the global variable
quick_panels_cache and at certain point when the view is closed i want to remove it from the dictionary.
Minimal code would be this:
def on_done(self, panel, action):
view = panel['view']
done = panel['done']
content = view.substr(sublime.Region(0, view.size()))
view_name = view.name()
if action == 'close':
def close_view(self, view):
window = self.window
Thing is, it doesn't matter which order of lines I use, this one:
or this one:
The result will be that sometimes Sublime Text (non-deterministic) will abort unexpectedly without giving any traceback nor warning and the only clues will be just putting some .dmp files on the root folder.
I guess this is happening because no matter the order of lines, at certain point the view instance isn't available anymore (because of GC and the fact than self.close_view is asynchronous) and the sublime_api commands are assuming the view instance to be present as a precondition, that's my assumption...
Trying to think a good fix of this one but the only i can think of is not removing the view instance from my global cache... but that's not a good solution at all, so... you got any better one?
Btw, the main reason why I'm using this global cache, apart of storing some bounded methods is because it seems you can't use non-json serializable objects with view.run_command)... Probably there is a better way of doing this though.
Thanks in advance.