From 1b1b6c89e39d620bed28f810bb2a8d8d51f1b306 Mon Sep 17 00:00:00 2001 From: Lyubomir Marinov Date: Fri, 25 Mar 2011 10:52:07 +0000 Subject: Fixes a crash in the JAWTRenderer on Mac OS X 10.5 reported by Emil Ivov and caused by use of 10.6+ API. --- lib/native/mac/libjawtrenderer.jnilib | Bin 89800 -> 89832 bytes src/native/jawtrenderer/JAWTRenderer_MacOSX.m | 21 ++++++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/native/mac/libjawtrenderer.jnilib b/lib/native/mac/libjawtrenderer.jnilib index c069b10..0954b49 100755 Binary files a/lib/native/mac/libjawtrenderer.jnilib and b/lib/native/mac/libjawtrenderer.jnilib differ diff --git a/src/native/jawtrenderer/JAWTRenderer_MacOSX.m b/src/native/jawtrenderer/JAWTRenderer_MacOSX.m index 0ae6227..27a2148 100644 --- a/src/native/jawtrenderer/JAWTRenderer_MacOSX.m +++ b/src/native/jawtrenderer/JAWTRenderer_MacOSX.m @@ -365,9 +365,24 @@ JAWTRenderer_removeNotifyLightweightComponent(jlong handle, jobject component) if (glContext) { - NSOpenGLPixelFormat *format - = [[NSOpenGLPixelFormat alloc] - initWithCGLPixelFormatObj:pixelFormat]; + NSOpenGLPixelFormat *format = [NSOpenGLPixelFormat alloc]; + + /* + * Unfortunately, initWithCGLPixelFormatObj: is available starting + * with Mac OS X 10.6. + */ + if ([format + respondsToSelector:@selector(initWithCGLPixelFormatObj:)]) + { + format = [format initWithCGLPixelFormatObj:pixelFormat]; + } + else + { + NSOpenGLPixelFormatAttribute pixelFormatAttribs[] + = { NSOpenGLPFAWindow, 0 }; + + format = [format initWithAttributes:pixelFormatAttribs]; + } self->glContext = [[NSOpenGLContext alloc] -- cgit v1.1