Tweak to fix a crash on exit, attempt to fix missing jawt error on

Java 7
This commit is contained in:
kappaOne 2013-02-20 22:20:23 +00:00
parent 6cd860525f
commit 0cbe94d9e3
3 changed files with 24 additions and 7 deletions

View File

@ -32,6 +32,10 @@
package org.lwjgl;
import com.apple.eio.FileManager;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedExceptionAction;
import java.lang.UnsatisfiedLinkError;
/**
*
@ -45,6 +49,19 @@ final class MacOSXSysImplementation extends J2SESysImplementation {
static {
// Manually start the AWT Application Loop
java.awt.Toolkit.getDefaultToolkit();
// manually load libjawt.dylib into vm, needed since Java 7
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
try {
System.loadLibrary("jawt");
} catch (UnsatisfiedLinkError e) {
// catch and ignore an already loaded in another classloader
// exception, as vm already has it loaded
}
return null;
}
});
}
public int getRequiredJNIVersion() {

View File

@ -153,11 +153,14 @@ static MacOSXPeerInfo *peer_info;
if (window_info->window != nil) {
// if the nsview has no parent then close window
if ([window_info->window contentView] == window_info->view) {
// release the nsview and remove it from any parent nsview
[window_info->view removeFromSuperviewWithoutNeedingDisplay];
[window_info->window close];
}
// release the nsview and remove it from any parent nsview
[window_info->view removeFromSuperviewWithoutNeedingDisplay];
else {
// release the nsview and remove it from any parent nsview
[window_info->view removeFromSuperviewWithoutNeedingDisplay];
}
}
}
}

View File

@ -214,14 +214,11 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nDestro
[context_info->context performSelectorOnMainThread:@selector(clearDrawable) withObject:nil waitUntilDone:YES];
if (context_info->peer_info->isWindowed) {
if (context_info->peer_info->window_info->view != nil) {
[context_info->peer_info->window_info->view setOpenGLContext:nil];
}
[context_info->context release];
context_info->context = nil;
context_info->peer_info->window_info->context = nil;
}
else [context_info->context release];
[pool release];
}