Merge
diff --git a/.hgtags b/.hgtags
index ddf400a..468e715 100644
--- a/.hgtags
+++ b/.hgtags
@@ -456,3 +456,4 @@
d433f5fd8910bee1f2c295b65cf03977034fe0ea jdk8u60-b24
c8cfbe57bcd5042d2fef42dcef14d73dd4bdc416 jdk8u60-b25
0d6a8a9b26a37678b420ff540b5a622c3f4fd44c jdk8u60-b26
+afbc08ea922bf6e5e14d2eea24a2f94f37627ea7 jdk8u60-b27
diff --git a/src/macosx/native/sun/awt/CFRetainedResource.m b/src/macosx/native/sun/awt/CFRetainedResource.m
index 1371189..b5650cd 100644
--- a/src/macosx/native/sun/awt/CFRetainedResource.m
+++ b/src/macosx/native/sun/awt/CFRetainedResource.m
@@ -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);