|
Re: Bug in java_nio_VMDirectByteBuffer.c: msg#00125java.classpath.patches
On Tue, Mar 15, 2005 at 10:25:50PM -0600, Archie Cobbs wrote: > There is a bug in java_nio_VMDirectByteBuffer.c in the function > Java_java_nio_VMDirectByteBuffer_init(). > > This function sets "classRawData", which is a static variable of type > jclass, from the result of calling (*env)->FindClass(), and then returns, > and then other JNI functions try to use this variable from within different > JNI invocations. > > This is broken because the local native reference that was created by > (*env)->FindClass() goes away when Java_java_nio_VMDirectByteBuffer_init() > returns (not to mention that it could be used from a different thread). > > The solution is to put a global native reference around "classRawData". > This fixes the problem for me. I'll commit the attached patch unless > there are issues. > > 2005-03-15 Archie Cobbs <archie@xxxxxxxxxxxx> > > * native/jni/java-nio/java_nio_VMDirectByteBuffer.c: use > global native reference to wrap persistent jclass variable. Thanks, Looks good. Can you point me to some explaining links on the web for this? All I found via goolge was not very well explaining. I think there are much more of these bugs in out JNI code and more in my upcoming new code. Perhaps I can fix them before commiting new code when I understand this more. Michael -- Java Trap: http://www.gnu.org/philosophy/java-trap.html
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Bug in java_nio_VMDirectByteBuffer.c, Archie Cobbs |
|---|---|
| Next by Date: | Re: FYI: boot library path update for VM integration guide, Mark Wielaard |
| Previous by Thread: | Bug in java_nio_VMDirectByteBuffer.c, Archie Cobbs |
| Next by Thread: | Re: Bug in java_nio_VMDirectByteBuffer.c, Archie Cobbs |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |