xbmc/xbmc — pull request #2319 by theuni (2013-02-28 07:39:48+00:00)
Title: [droid] attach/detach the jvm using thread storage

Finally got around to this after being bitten too many times by manual thread attach/detach. Sorry for the big patch, but there was really no splitting this one up.

Threads are automatically attached when issuing a xbmc_jnienv(), and detach
automatically at destruction.

This eliminates manual intervention, and likely will save us from some bugs in
the future. The old code was very difficult to maintain since every function
had to assume that it was not attached and had to detach when finished.

This is the method recommended in the Android docs.

Current master suffers from a segfault on shutdown *without* this patch, that will need to be fixed before pushing this one in, so that we can separate any resulting issues.