Mercurial > hg > openjdk > jdk8u > jdk
changeset 11161:afbc08ea922b jdk8u60-b27
8132382: [macosx] Crash during JMC or JavaFX execution when NSApplication is controlled by SWT or JavaFX libraries
Reviewed-by: kizune, alexsch
author | serb |
---|---|
date | Thu, 30 Jul 2015 15:27:02 +0300 |
parents | 673edf1d3392 |
children | 48e79820c798 |
files | src/macosx/native/sun/awt/CFRetainedResource.m |
diffstat | 1 files changed, 12 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/macosx/native/sun/awt/CFRetainedResource.m Wed Jul 29 13:11:07 2015 -0700 +++ b/src/macosx/native/sun/awt/CFRetainedResource.m Thu Jul 30 15:27:02 2015 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,10 +40,17 @@ if (releaseOnAppKitThread) { // Releasing resources on the main AppKit message loop only // Releasing resources on the nested loops may cause dangling - // pointers after the nested loop is exited - [NSApp postRunnableEvent:^(){ - CFRelease(jlong_to_ptr(ptr)); - }]; + // pointers after the nested loop is exited + if ([NSApp respondsToSelector:@selector(postRunnableEvent:)]) { + [NSApp postRunnableEvent:^() { + CFRelease(jlong_to_ptr(ptr)); + }]; + } else { + // could happen if we are embedded inside SWT/FX application, + [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^() { + CFRelease(jlong_to_ptr(ptr)); + }]; + } } else { JNF_COCOA_ENTER(env);