* Patch: FYI: fix PR 28178
@ 2006-06-27 15:33 Tom Tromey
2006-06-27 15:40 ` Tom Tromey
0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2006-06-27 15:33 UTC (permalink / raw)
To: Java Patch List
I'm checking this in on the trunk.
This fixes PR 28178, a small JNI bug.
Test case included.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
PR libgcj/28178:
* jni.cc (_Jv_JNI_DeleteLocalRef): Ignore null argument.
(_Jv_JNI_DeleteGlobalRef): Likewise.
* testsuite/libjava.jni/PR28178.java: New file.
* testsuite/libjava.jni/PR28178.c: New file.
* testsuite/libjava.jni/PR28178.out: New file.
Index: jni.cc
===================================================================
--- jni.cc (revision 115024)
+++ jni.cc (working copy)
@@ -248,6 +248,12 @@
{
// This seems weird but I think it is correct.
obj = unwrap (obj);
+
+ // NULL is ok here -- the JNI specification doesn't say so, but this
+ // is a no-op.
+ if (! obj)
+ return;
+
unmark_for_gc (obj, global_ref_table);
}
@@ -259,6 +265,11 @@
// This seems weird but I think it is correct.
obj = unwrap (obj);
+ // NULL is ok here -- the JNI specification doesn't say so, but this
+ // is a no-op.
+ if (! obj)
+ return;
+
for (frame = env->locals; frame != NULL; frame = frame->next)
{
for (int i = 0; i < frame->size; ++i)
Index: testsuite/libjava.jni/PR28178.java
===================================================================
--- testsuite/libjava.jni/PR28178.java (revision 0)
+++ testsuite/libjava.jni/PR28178.java (revision 0)
@@ -0,0 +1,15 @@
+// Regression test for PR 28178.
+
+public class PR28178
+{
+ static {
+ System.loadLibrary("PR28178");
+ }
+
+ public static native void m();
+
+ public static void main(String[] args)
+ {
+ m();
+ }
+}
Index: testsuite/libjava.jni/PR28178.out
===================================================================
Index: testsuite/libjava.jni/PR28178.c
===================================================================
--- testsuite/libjava.jni/PR28178.c (revision 0)
+++ testsuite/libjava.jni/PR28178.c (revision 0)
@@ -0,0 +1,10 @@
+#include <PR28178.h>
+
+void
+Java_PR28178_m (JNIEnv *env, jclass ignore)
+{
+ (*env)->DeleteLocalRef(env, NULL);
+ (*env)->DeleteGlobalRef(env, NULL);
+}
+
+
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Patch: FYI: fix PR 28178
2006-06-27 15:33 Patch: FYI: fix PR 28178 Tom Tromey
@ 2006-06-27 15:40 ` Tom Tromey
0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2006-06-27 15:40 UTC (permalink / raw)
To: Java Patch List
>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:
Tom> I'm checking this in on the trunk.
I neglected to mention that I'm also checking it in on the 4.1 branch.
Tom
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-06-27 15:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-27 15:33 Patch: FYI: fix PR 28178 Tom Tromey
2006-06-27 15:40 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).