Crashes in Java_sun_lwawt_macosx_LWCToolkit_stopAWTRunLoop (called with NULL argument)
Michael Hall
mik3hall at gmail.com
Fri Aug 29 21:39:22 UTC 2014
On Aug 29, 2014, at 7:45 AM, Hendrik Schreiber <hs at tagtraum.com> wrote:
> public void exit() {
> if (!isOwned()) {
> throw new IllegalMonitorStateException();
> }
> LWCToolkit.stopAWTRunLoop(awtRunLoopMediator);
> awtRunLoopMediator = 0;
> }
What does isOwned() do? Doesn't it ensure that clearing the loop mediator is only done by the owning thread? If some other thread successfully runs through exit doesn't it mean this is not working correctly?
Also, looking at
http://code.metager.de/source/xref/openjdk/jdk8/jdk/src/macosx/native/sun/awt/LWCToolkit.m
/*
* Class: sun_lwawt_macosx_LWCToolkit
* Method: stopAWTRunLoop
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_LWCToolkit_stopAWTRunLoop
(
JNIEnv *env, jclass clz, jlong mediator
)
{
JNF_COCOA_ENTER(env
);
AWTRunLoopObject* mediatorObject = (AWTRunLoopObject*)jlong_to_ptr(mediator
);
[
ThreadUtilities performOnMainThread:@selector(endRunLoop) on:mediatorObject withObject:nil waitUntilDone:NO
];
CFRelease(mediatorObject
);
JNF_COCOA_EXIT(env
);
}
Wouldn't it be simpler and safer to fix it in the JNI?
if (mediatorObject) CFRelease(mediatorObject);
Michael Hall
trz nio.2 for OS X http://www195.pair.com/mik3hall/index.html#trz
HalfPipe Java 6/7 shell app http://www195.pair.com/mik3hall/index.html#halfpipe
AppConverter convert Apple jvm to openjdk apps http://www195.pair.com/mik3hall/index.html#appconverter
More information about the macosx-port-dev
mailing list