summaryrefslogtreecommitdiffstats
path: root/src/nativewindow/native/macosx/OSXmisc.m
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2019-09-08 12:56:57 +0200
committerSven Gothel <[email protected]>2019-09-08 12:56:57 +0200
commit534d764474cacf8bc380123cbfd164c7c55f236a (patch)
treef87a883e0962df6a8e6d9270967527fba943e37c /src/nativewindow/native/macosx/OSXmisc.m
parent125e4bd1c8e0a8f4b434209b155e6cd0d8f09092 (diff)
Buig 1389: Fix SIGSEGV on OpenJDK11 on [NSApplicationAWT sendEvent:]
Culprit of the crash and the non propagated action on NSApp main-thread was _simply_ our OSXUtil_KickNSApp() 'kick alive' NSApplicationDefined NSEvent sent to the NSApp. Java11's NSApp code overrides sendEvent and handles NSApplicationDefined + subtype=ExecuteBlockEvent using the given data1 as a function pointer. 8-O ExecuteBlockEvent defined as 0, which we have sent. Simply passing subtype=8888 avoids this side-effect. Whether it is still required to KickNSApp() is another question. +++ Further, make code a bit more robuts regarding the offscreenSurfaceLayer at JAWTWindow invalidate. I.e. if still not detached, do the late cleanup there. This just in case the OSX Context callback to disassociate the drawable has been missed.
Diffstat (limited to 'src/nativewindow/native/macosx/OSXmisc.m')
-rw-r--r--src/nativewindow/native/macosx/OSXmisc.m9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/nativewindow/native/macosx/OSXmisc.m b/src/nativewindow/native/macosx/OSXmisc.m
index 1135c5fb2..a24f9291e 100644
--- a/src/nativewindow/native/macosx/OSXmisc.m
+++ b/src/nativewindow/native/macosx/OSXmisc.m
@@ -807,10 +807,10 @@ NS_ENDHANDLER
/*
* Class: Java_jogamp_nativewindow_macosx_OSXUtil
* Method: RemoveCASublayer0
- * Signature: (JJ)V
+ * Signature: (JJZ)V
*/
JNIEXPORT void JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_RemoveCASublayer0
- (JNIEnv *env, jclass unused, jlong rootCALayer, jlong subCALayer)
+ (JNIEnv *env, jclass unused, jlong rootCALayer, jlong subCALayer, jboolean subCALayerRelease)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
MyCALayer* rootLayer = (MyCALayer*) ((intptr_t) rootCALayer);
@@ -826,6 +826,9 @@ JNIEXPORT void JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_RemoveCASublayer0
[subLayer removeFromSuperlayer];
[subLayer release]; // Pairs w/ AddCASublayer
+ if( subCALayerRelease ) {
+ [subLayer release];
+ }
[rootLayer release]; // Pairs w/ AddCASublayer
[CATransaction commit];
@@ -1051,7 +1054,7 @@ static void OSXUtil_KickNSApp() {
timestamp: 0.0
windowNumber: 0
context: nil
- subtype: 0
+ subtype: 8888 /* Bug 1389: Avoid JDK impl sendEvent types, utilizing data1 or data2 */
data1: 0
data2: 0];
[NSApp postEvent: event atStart: true];