mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
JRE-1083 [JDK11] Test com/sun/java/accessibility/util/8051626/Bug8051626.java fails on macOS on JB JDK11b
Wrapped SelectorPerformer invocation into privileged action (cherry picked from commit48e7b547ae) (cherry picked from commite420b10a4a)
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
|
||||
package sun.lwawt.macosx;
|
||||
|
||||
import java.awt.AWTError;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.DefaultKeyboardFocusManager;
|
||||
@@ -52,7 +53,7 @@ import java.util.Comparator;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
import javax.swing.JRootPane;
|
||||
import javax.swing.RootPaneContainer;
|
||||
@@ -341,28 +342,35 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
} else {
|
||||
bounds = _peer.constrainBounds(_target.getBounds());
|
||||
}
|
||||
long nativeWindowPtr = LWCToolkit.SelectorPerformer.perform(() -> {
|
||||
AtomicLong ref = new AtomicLong();
|
||||
contentView.execute(viewPtr -> {
|
||||
boolean hasOwnerPtr = false;
|
||||
long nativeWindowPtr = java.security.AccessController.doPrivileged(
|
||||
(PrivilegedAction<Long>) () -> {
|
||||
try {
|
||||
return LWCToolkit.SelectorPerformer.perform(() -> {
|
||||
AtomicLong ref = new AtomicLong();
|
||||
contentView.execute(viewPtr -> {
|
||||
boolean hasOwnerPtr = false;
|
||||
|
||||
if (owner != null) {
|
||||
hasOwnerPtr = 0L != owner.executeGet(ownerPtr -> {
|
||||
ref.set(nativeCreateNSWindow(viewPtr, ownerPtr, styleBits,
|
||||
bounds.x, bounds.y,
|
||||
bounds.width, bounds.height));
|
||||
return 1;
|
||||
});
|
||||
}
|
||||
if (owner != null) {
|
||||
hasOwnerPtr = 0L != owner.executeGet(ownerPtr -> {
|
||||
ref.set(nativeCreateNSWindow(viewPtr, ownerPtr, styleBits,
|
||||
bounds.x, bounds.y,
|
||||
bounds.width, bounds.height));
|
||||
return 1;
|
||||
});
|
||||
}
|
||||
|
||||
if (!hasOwnerPtr) {
|
||||
ref.set(nativeCreateNSWindow(viewPtr, 0,
|
||||
styleBits, bounds.x, bounds.y,
|
||||
bounds.width, bounds.height));
|
||||
}
|
||||
});
|
||||
return ref.get();
|
||||
});
|
||||
if (!hasOwnerPtr) {
|
||||
ref.set(nativeCreateNSWindow(viewPtr, 0,
|
||||
styleBits, bounds.x, bounds.y,
|
||||
bounds.width, bounds.height));
|
||||
}
|
||||
});
|
||||
return ref.get();
|
||||
});
|
||||
} catch (Throwable throwable) {
|
||||
throw new AWTError(throwable.getMessage());
|
||||
}
|
||||
});
|
||||
setPtr(nativeWindowPtr);
|
||||
if (peer != null) {
|
||||
peer.setTextured(IS(TEXTURED, styleBits));
|
||||
|
||||
Reference in New Issue
Block a user