Workaround Nvidia driver bug which crashed the OS when releasing a

shared context by not releasing shared contexts.
This commit is contained in:
kappaOne 2013-04-14 14:14:36 +01:00
parent 529acd40ff
commit a7c704ae2f
2 changed files with 11 additions and 3 deletions

View File

@ -285,7 +285,9 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_MacOSXCanvasPeerInfo_nInitHandle
}
- (void)releaseCGLContext:(CGLContextObj)glContext {
CGLDestroyContext(contextObject);
CGLClearDrawable(contextObject);
// disable releasing context due to nvidia crash bug when releasing shared contexts
//CGLDestroyContext(contextObject);
}
- (CGLPixelFormatObj)copyCGLPixelFormatForDisplayMask:(uint32_t)mask {

View File

@ -219,10 +219,11 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nDestro
[context_info->peer_info->glLayer performSelectorOnMainThread:@selector(removeLayer) withObject:nil waitUntilDone:YES];
[context_info->peer_info->glLayer release];
context_info->peer_info->glLayer = nil;
// don't release context due to nvidia driver bug when releasing shared contexts
[context_info->context retain];
}
// clearDrawable on main thread to ensure its not in use
[context_info->context performSelectorOnMainThread:@selector(clearDrawable) withObject:nil waitUntilDone:YES];
[context_info->context clearDrawable];
if (context_info->peer_info->isWindowed) {
[context_info->peer_info->window_info->view setOpenGLContext:nil];
@ -230,6 +231,11 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nDestro
context_info->context = nil;
context_info->peer_info->window_info->context = nil;
}
else {
// don't release context due to nvidia driver bug when releasing shared contexts
//[context_info->context release];
//context_info->context = nil;
}
[pool release];
}