diff options
-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` |