jni fixlet

Marco Trudel mtrudel@gmx.ch
Thu Feb 1 20:47:00 GMT 2007


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...


Attached the version with the comment on the second line.


Marco
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: jni-fixlet2.txt
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20070201/b528791e/attachment.txt>


More information about the Java-patches mailing list