diff options
author | nfnty <git@nfnty.se> | 2017-01-30 02:12:18 +0100 |
---|---|---|
committer | nfnty <git@nfnty.se> | 2017-01-30 02:21:17 +0100 |
commit | 36287121fc87a89bb6fed608ffe7324ee702e747 (patch) | |
tree | 6faeaa702607d3ccbe0eb9bb12b832e76245297d /ranger | |
parent | 02b5366f83660f2f8d4b80e761c28e92a0e92e2a (diff) | |
download | ranger-36287121fc87a89bb6fed608ffe7324ee702e747.tar.gz |
ext.vcs.vcs: VcsThread: Fix overridden instance attribute exception
``` Exception ignored in: <module 'threading' from '/usr/lib/python3.6/threading.py'> Traceback (most recent call last): File "/usr/lib/python3.6/threading.py", line 1349, in _after_forkles thread._stop() TypeError: 'Event' object is not callable ```
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/ext/vcs/vcs.py | 7 | ||||
-rw-r--r-- | ranger/gui/ui.py | 6 |
2 files changed, 8 insertions, 5 deletions
diff --git a/ranger/ext/vcs/vcs.py b/ranger/ext/vcs/vcs.py index 18077c6d..ba28d141 100644 --- a/ranger/ext/vcs/vcs.py +++ b/ranger/ext/vcs/vcs.py @@ -376,7 +376,7 @@ class VcsThread(threading.Thread): # pylint: disable=too-many-instance-attribut self.daemon = True self._ui = ui self._queue = queue.Queue() - self._stop = threading.Event() + self.__stop = threading.Event() self.stopped = threading.Event() self._advance = threading.Event() self._advance.set() @@ -455,7 +455,7 @@ class VcsThread(threading.Thread): # pylint: disable=too-many-instance-attribut self.paused.set() self._advance.wait() self._awoken.wait() - if self._stop.isSet(): + if self.__stop.isSet(): self.stopped.set() return if not self._advance.isSet(): @@ -478,11 +478,12 @@ class VcsThread(threading.Thread): # pylint: disable=too-many-instance-attribut def stop(self): """Stop thread synchronously""" - self._stop.set() + self.__stop.set() self.paused.wait(5) self._advance.set() self._awoken.set() self.stopped.wait(1) + return self.stopped.isSet() def pause(self): """Pause thread""" diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py index 1a930a23..0227bad4 100644 --- a/ranger/gui/ui.py +++ b/ranger/gui/ui.py @@ -133,7 +133,7 @@ class UI( # pylint: disable=too-many-instance-attributes,too-many-public-method """Turn off curses""" if 'vcsthread' in self.__dict__: self.vcsthread.pause() - self.vcsthread.paused.wait(5) + self.vcsthread.paused.wait() self.win.keypad(0) curses.nocbreak() @@ -165,7 +165,9 @@ class UI( # pylint: disable=too-many-instance-attributes,too-many-public-method def destroy(self): """Destroy all widgets and turn off curses""" if 'vcsthread' in self.__dict__: - self.vcsthread.stop() + if not self.vcsthread.stop(): + self.fm.notify('Failed to stop `UI.vcsthread`', bad=True) + del self.__dict__['vcsthread'] DisplayableContainer.destroy(self) # Restore tmux setting `automatic-rename` |