diff --git a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java index 539ea8894839306a399ea97963f1045eba43533b..32ef49d93e3e7bd648c6a9bbb1181d1760e4e443 100644 --- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java @@ -251,13 +251,18 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo } 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));