File tree Expand file tree Collapse file tree 2 files changed +4
-22
lines changed
Expand file tree Collapse file tree 2 files changed +4
-22
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ using namespace std;
1313
1414
1515
16- JEnv::JEnv (bool detach )
17- : m_detach(detach), m_env(nullptr )
16+ JEnv::JEnv ()
17+ : m_env(nullptr )
1818{
1919 JNIEnv *env = nullptr ;
2020 jint ret = s_jvm->GetEnv (reinterpret_cast <void **>(&env), JNI_VERSION_1_6);
@@ -29,29 +29,12 @@ JEnv::JEnv(bool detach)
2929}
3030
3131JEnv::JEnv (JNIEnv *jniEnv)
32- : m_env(jniEnv), m_detach( false )
32+ : m_env(jniEnv)
3333{
3434}
3535
3636JEnv::~JEnv ()
3737{
38- if (m_detach)
39- {
40- pid_t pid = getpid ();
41- pid_t tid = gettid ();
42-
43- if (pid != tid)
44- {
45- JNIEnv *env = nullptr ;
46- jint ret = s_jvm->GetEnv (reinterpret_cast <void **>(&env), JNI_VERSION_1_6);
47-
48- if ((ret == JNI_OK) && (env != nullptr ))
49- {
50- jint ret = s_jvm->DetachCurrentThread ();
51- assert (ret == JNI_OK);
52- }
53- }
54- }
5538}
5639
5740JEnv::operator JNIEnv*() const
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ namespace tns
1010 class JEnv
1111 {
1212 public:
13- JEnv (bool detach = false );
13+ JEnv ();
1414
1515 JEnv (JNIEnv *jniEnv);
1616
@@ -324,7 +324,6 @@ namespace tns
324324 void CheckForJavaException ();
325325
326326 JNIEnv *m_env;
327- bool m_detach;
328327
329328 static JavaVM *s_jvm;
330329
You can’t perform that action at this time.
0 commit comments