fix crash on exit by removing NSView before destroying the NSWindow, so

that it doesn't draw after being removed
This commit is contained in:
kappaOne 2012-11-25 18:38:46 +00:00
parent c2159989f5
commit 9a968e8c41
1 changed files with 5 additions and 1 deletions

View File

@ -139,7 +139,7 @@ static NSAutoreleasePool *pool;
NSOpenGLContext* context = [self openGLContext];
[super lockFocus];
if ([context view] != nil && [context view] != self) {
if ([context view] != self && [context view] != nil) {
[context setView:self];
}
@ -503,6 +503,10 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nCreateWindow(JNIE
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nDestroyWindow(JNIEnv *env, jobject this, jobject window_handle) {
MacOSXWindowInfo *window_info = (MacOSXWindowInfo *)(*env)->GetDirectBufferAddress(env, window_handle);
if (window_info->view != nil) {
[window_info->view removeFromSuperviewWithoutNeedingDisplay];
}
if (window_info->fullscreen) {
[window_info->view exitFullScreenModeWithOptions: nil];
}