This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: jni fixlet
David Daney wrote:
Marco Trudel wrote:
David Daney wrote:
Marco Trudel wrote:
Attached a jni fixlet.
2007-02-01 Marco Trudel <mtrudel@gmx.ch>
* jni.cc (_Jv_JNI_DeleteWeakGlobalRef): Check for NULL objects.
Question? Comments?
What was the undesirable behavior you observed that this patch fixes?
A compiled application crashed with "Aborted". A native lib called
"_Jv_JNI_DeleteWeakGlobalRef" with a null obj what in the end causes a
segmentation fault in unmark_for_gc:
jint val = refcount->intValue() - 1; (refcount null)
How did you test it?
I played a little with gdb, saw the segfault, added a check, compiled
my app again and was happy that it worked.
Ah, and I then ran the library I use which does this null call in a
Sun JVM to ensure that there _Jv_JNI_DeleteWeakGlobalRef is also
called with NULL. It is...
Usually you whould run the libgcj testsuite before and after the change.
That would show that the patch does not affect any existing test
cases. Optionally you could add a test case for this.
It looks safe, but you can never tell until you run the tests.
Yes, you're right. I'll do that and repost once I have time...
Marco