------- Comment #12 from stewart at neuron dot com  2005-10-12 20:29 -------
Tom,

This patch from you against gcc-4.0.2 cured the segfault.

Thanks,
Stewart


Index: jni.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/jni.cc,v
retrieving revision 1.95.2.2
diff -u -r1.95.2.2 jni.cc
--- jni.cc 6 Sep 2005 16:03:11 -0000 1.95.2.2
+++ jni.cc 12 Oct 2005 18:50:20 -0000
@@ -2341,10 +2341,14 @@
     }

   // 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;


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13212

Reply via email to