8178996: [macos] JComboBox doesn't display popup in mixed JavaFX Swing Application on 8u131 and Mac OS 10.12
authorazvegint
Fri, 12 May 2017 15:01:22 +0300
changeset 45345 f5223be944fa
parent 45344 60b7b5f39580
child 45346 6a9a31dea229
8178996: [macos] JComboBox doesn't display popup in mixed JavaFX Swing Application on 8u131 and Mac OS 10.12 Reviewed-by: serb, ssadetsky
jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Fri May 12 12:28:49 2017 +0530
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Fri May 12 15:01:22 2017 +0300
@@ -274,13 +274,18 @@
         }
         AtomicLong ref = new AtomicLong();
         contentView.execute(viewPtr -> {
+            boolean hasOwnerPtr = false;
+
             if (owner != null) {
-                owner.execute(ownerPtr -> {
+                hasOwnerPtr = 0L != owner.executeGet(ownerPtr -> {
                     ref.set(nativeCreateNSWindow(viewPtr, ownerPtr, styleBits,
-                                                 bounds.x, bounds.y,
-                                                 bounds.width, bounds.height));
+                                                    bounds.x, bounds.y,
+                                                    bounds.width, bounds.height));
+                    return 1;
                 });
-            } else {
+            }
+
+            if (!hasOwnerPtr) {
                 ref.set(nativeCreateNSWindow(viewPtr, 0,
                                              styleBits, bounds.x, bounds.y,
                                              bounds.width, bounds.height));