Skip to content

Commit

Permalink
call detach on all threads before exiting
Browse files Browse the repository at this point in the history
  • Loading branch information
akshayaurora committed Oct 26, 2016
1 parent 98596b3 commit 9838660
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions jnius/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,14 @@ def equals(self, other):
return self.hashCode() == other.hashCode()

PythonJavaClass = PythonJavaClass_


# from https://gist.github.com/tito/09c42fb4767721dc323d
import threading
orig_thread_run = threading.Thread.run
def thread_check_run(*args, **kwargs):
try:
return orig_thread_run(*args, **kwargs)
finally:
jnius.detach()
threading.Thread.run = thread_check_run

1 comment on commit 9838660

@Cheaterman
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why this works with kivy.network.UrlRequest since it overrides the .run(). In fact, I made my own little UrlRequest-like class for various reasons, and I get #107 .
Since I don't get it, I'll just call super().run() for now. Very weird.

Please sign in to comment.