summaryrefslogtreecommitdiffstats
path: root/src/newt/native/MacWindow.m
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-01-03 04:29:38 +0100
committerSven Gothel <[email protected]>2014-01-03 04:29:38 +0100
commitbb5c7496ed92b91dded30816a46b42ff85f37bec (patch)
treea07604394d72291734783e661379b137e2b5b6c9 /src/newt/native/MacWindow.m
parent09db30c4a0d9c0f29c47af76238b2abc275301c0 (diff)
Bug 935: NEWT PointerIcon OSX: Safe use of NSCursor handle
Diffstat (limited to 'src/newt/native/MacWindow.m')
-rw-r--r--src/newt/native/MacWindow.m17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/newt/native/MacWindow.m b/src/newt/native/MacWindow.m
index 8a466b95e..1be3a6ed5 100644
--- a/src/newt/native/MacWindow.m
+++ b/src/newt/native/MacWindow.m
@@ -340,6 +340,7 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_macosx_DisplayDriver_createPoint
res = [[NSCursor alloc] initWithImage: nsImage hotSpot: hotP];
}
[pool release];
+ DBG_PRINT( "createPointerIcon0 %p\n", res);
return (jlong) (intptr_t) res;
}
@@ -348,7 +349,14 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_DisplayDriver_destroyPoint
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSCursor * c = (NSCursor*) (intptr_t) handle ;
- [c release];
+ if( NULL != c ) {
+ if ( NO == [c isKindOfClass:[NSCursor class]] ) {
+ DBG_PRINT( "destroyPointerIcon0 NSCursor %p - is of invalid type\n", c);
+ } else {
+ DBG_PRINT( "destroyPointerIcon0 %p\n", c);
+ [c release];
+ }
+ }
[pool release];
}
@@ -358,8 +366,11 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_setPointerIco
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NewtMacWindow *mWin = (NewtMacWindow*) (intptr_t) window;
NSCursor * c = (NSCursor*) (intptr_t) handle ;
-
- [mWin setCustomCursor: c];
+ if ( NULL != c && NO == [c isKindOfClass:[NSCursor class]] ) {
+ DBG_PRINT( "setPointerIcon0 NSCursor %p - is of invalid type (1)\n", c);
+ } else {
+ [mWin setPointerIcon: c];
+ }
[pool release];
}