tcall jnius.detach on thread stop - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit bbe7b277d2e8815977e399d2dad25e535c09b13d DIR parent 5f3b6af2e03414e58b9ad1ff4d1df89847dd89a5 HTML Author: ThomasV <thomasv@electrum.org> Date: Sat, 4 Jun 2016 12:58:29 +0200 call jnius.detach on thread stop Diffstat: M lib/daemon.py | 1 + M lib/network.py | 2 +- M lib/plugins.py | 2 +- M lib/util.py | 6 ++++++ 4 files changed, 9 insertions(+), 2 deletions(-) --- DIR diff --git a/lib/daemon.py b/lib/daemon.py t@@ -220,6 +220,7 @@ class Daemon(DaemonThread): self.print_error("shutting down network") self.network.stop() self.network.join() + self.on_stop() def stop(self): self.print_error("stopping, removing lockfile") DIR diff --git a/lib/network.py b/lib/network.py t@@ -814,7 +814,7 @@ class Network(util.DaemonThread): self.process_pending_sends() self.stop_network() - self.print_error("stopped") + self.on_stop() def on_header(self, i, header): height = header.get('block_height') DIR diff --git a/lib/plugins.py b/lib/plugins.py t@@ -169,7 +169,7 @@ class Plugins(DaemonThread): while self.is_running(): time.sleep(0.1) self.run_jobs() - self.print_error("stopped") + self.on_stop() hook_names = set() DIR diff --git a/lib/util.py b/lib/util.py t@@ -149,6 +149,12 @@ class DaemonThread(threading.Thread, PrintError): with self.running_lock: self.running = False + def on_stop(self): + if 'ANDROID_DATA' in os.environ: + import jnius + jnius.detach() + self.print_error("jnius detach") + self.print_error("stopped") is_verbose = False