summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-09-08 08:27:03 +0200
committerSven Gothel <[email protected]>2014-09-08 08:27:03 +0200
commitc0c722b9f479412f27973ba0c4cd4a166dcb00be (patch)
tree15996622d91b52d9aed3b2ea3372644399ebcfb6
parentef7ecf76e28a89b1cdef6c3c7b4ccca123921ae1 (diff)
Bug 1065: Handle NULL result of TISGetInputSourceProperty(keyboard, kTISPropertyUnicodeKeyLayoutData), avoiding crashv2.2.1
-rw-r--r--make/scripts/tests.sh4
-rw-r--r--src/newt/native/NewtMacWindow.m9
2 files changed, 9 insertions, 4 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 2a9ed0bf1..e3f7d943b 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -376,7 +376,7 @@ function testawtswt() {
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLVersionParsing00NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLWindowNEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLCanvasAWT $*
-testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile00NEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile00NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile01NEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestVersionSemanticsNOUI $*
@@ -414,7 +414,7 @@ testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile00NEWT $*
#testawtswt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasSWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestElektronenMultipliziererNEWT $*
#testnoawtatomics com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
+testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestRedSquareES2NEWT $*
#testswt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasSWT $*
#testswt com.jogamp.opengl.test.junit.jogl.demos.es2.swt.TestGearsES2SWT $*
diff --git a/src/newt/native/NewtMacWindow.m b/src/newt/native/NewtMacWindow.m
index 5a1963155..caf9e54e0 100644
--- a/src/newt/native/NewtMacWindow.m
+++ b/src/newt/native/NewtMacWindow.m
@@ -124,6 +124,9 @@ static CFStringRef CKCH_CreateStringForKey(CGKeyCode keyCode, const UCKeyboardLa
static CFMutableDictionaryRef CKCH_CreateCodeToCharDict(TISInputSourceRef keyboard) {
CFDataRef layoutData = (CFDataRef) TISGetInputSourceProperty(keyboard, kTISPropertyUnicodeKeyLayoutData);
+ if( NULL == layoutData ) {
+ return NULL;
+ }
const UCKeyboardLayout *keyboardLayout = (const UCKeyboardLayout *)CFDataGetBytePtr(layoutData);
CFMutableDictionaryRef codeToCharDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 128, NULL, NULL);
@@ -149,8 +152,10 @@ static CFMutableDictionaryRef CKCH_USCodeToNNChar = NULL;
static void CKCH_CreateDictionaries() {
TISInputSourceRef currentKeyboard = TISCopyCurrentKeyboardInputSource();
- CKCH_USCodeToNNChar = CKCH_CreateCodeToCharDict(currentKeyboard);
- CFRelease(currentKeyboard);
+ if( NULL != currentKeyboard ) {
+ CKCH_USCodeToNNChar = CKCH_CreateCodeToCharDict(currentKeyboard);
+ CFRelease(currentKeyboard);
+ }
}
static UniChar CKCH_CharForKeyCode(jshort keyCode) {