summaryrefslogtreecommitdiff
path: root/libjava/jni.cc
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2006-01-19 00:57:00 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2006-01-19 00:57:00 +0000
commit1cfb751a0795f68351f6d6610e234f1dc599f0e7 (patch)
tree07c7e50757b9549955bd62df9c7e3dea9daadeeb /libjava/jni.cc
parent4a55687c47b75f8a8efa1fd8d68dddd28c8406a9 (diff)
downloadgcc-1cfb751a0795f68351f6d6610e234f1dc599f0e7.tar.gz
* jni.cc (_Jv_JNI_AttachCurrentThread): Return environment if it
already exists. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@109936 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/jni.cc')
-rw-r--r--libjava/jni.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/libjava/jni.cc b/libjava/jni.cc
index fd827065718..5a93753f006 100644
--- a/libjava/jni.cc
+++ b/libjava/jni.cc
@@ -1,6 +1,6 @@
// jni.cc - JNI implementation, including the jump table.
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation
This file is part of libgcj.
@@ -2352,10 +2352,14 @@ _Jv_JNI_AttachCurrentThread (JavaVM *, jstring name, void **penv,
}
// Attaching an already-attached thread is a no-op.
- if (_Jv_GetCurrentJNIEnv () != NULL)
- return 0;
+ JNIEnv *env = _Jv_GetCurrentJNIEnv ();
+ if (env != NULL)
+ {
+ *penv = reinterpret_cast<void *> (env);
+ return 0;
+ }
- JNIEnv *env = (JNIEnv *) _Jv_MallocUnchecked (sizeof (JNIEnv));
+ env = (JNIEnv *) _Jv_MallocUnchecked (sizeof (JNIEnv));
if (env == NULL)
return JNI_ERR;
env->p = &_Jv_JNIFunctions;