mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
remove excessive wrapping with AccessController (AWTThreading does it internally now)
as part of JBR-3017
(cherry picked from commit f1dd523ba8)
This commit is contained in:
@@ -25,7 +25,6 @@
|
||||
|
||||
package sun.lwawt.macosx;
|
||||
|
||||
import java.awt.AWTError;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.DefaultKeyboardFocusManager;
|
||||
@@ -53,7 +52,6 @@ import java.util.Comparator;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
import javax.swing.JRootPane;
|
||||
import javax.swing.RootPaneContainer;
|
||||
@@ -355,51 +353,43 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
} else {
|
||||
bounds = _peer.constrainBounds(_target.getBounds());
|
||||
}
|
||||
@SuppressWarnings("removal")
|
||||
long nativeWindowPtr = java.security.AccessController.doPrivileged(
|
||||
(PrivilegedAction<Long>) () -> {
|
||||
try {
|
||||
return AWTThreading.executeWaitToolkit(() -> {
|
||||
AtomicLong ref = new AtomicLong();
|
||||
contentView.execute(viewPtr -> {
|
||||
boolean hasOwnerPtr = false;
|
||||
long nativeWindowPtr = AWTThreading.executeWaitToolkit(() -> {
|
||||
AtomicLong ref = new AtomicLong();
|
||||
contentView.execute(viewPtr -> {
|
||||
boolean hasOwnerPtr = false;
|
||||
|
||||
if (owner != null) {
|
||||
hasOwnerPtr = 0L != owner.executeGet(ownerPtr -> {
|
||||
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
logger.fine("nativeCreateNSWindow: owner=" + Long.toHexString(ownerPtr)
|
||||
+ ", styleBits=" + Integer.toHexString(styleBits)
|
||||
+ ", bounds=" + bounds);
|
||||
}
|
||||
long windowPtr = nativeCreateNSWindow(viewPtr, ownerPtr, styleBits,
|
||||
bounds.x, bounds.y, bounds.width, bounds.height);
|
||||
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
logger.fine("window created: " + Long.toHexString(windowPtr));
|
||||
}
|
||||
ref.set(windowPtr);
|
||||
return 1;
|
||||
});
|
||||
}
|
||||
if (owner != null) {
|
||||
hasOwnerPtr = 0L != owner.executeGet(ownerPtr -> {
|
||||
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
logger.fine("nativeCreateNSWindow: owner=" + Long.toHexString(ownerPtr)
|
||||
+ ", styleBits=" + Integer.toHexString(styleBits)
|
||||
+ ", bounds=" + bounds);
|
||||
}
|
||||
long windowPtr = nativeCreateNSWindow(viewPtr, ownerPtr, styleBits,
|
||||
bounds.x, bounds.y, bounds.width, bounds.height);
|
||||
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
logger.fine("window created: " + Long.toHexString(windowPtr));
|
||||
}
|
||||
ref.set(windowPtr);
|
||||
return 1;
|
||||
});
|
||||
}
|
||||
|
||||
if (!hasOwnerPtr) {
|
||||
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
logger.fine("nativeCreateNSWindow: styleBits=" + Integer.toHexString(styleBits)
|
||||
+ ", bounds=" + bounds);
|
||||
}
|
||||
long windowPtr = nativeCreateNSWindow(viewPtr, 0, styleBits,
|
||||
bounds.x, bounds.y, bounds.width, bounds.height);
|
||||
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
logger.fine("window created: " + Long.toHexString(windowPtr));
|
||||
}
|
||||
ref.set(windowPtr);
|
||||
}
|
||||
});
|
||||
return ref.get();
|
||||
});
|
||||
} catch (Throwable throwable) {
|
||||
throw new AWTError(throwable.getMessage());
|
||||
if (!hasOwnerPtr) {
|
||||
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
logger.fine("nativeCreateNSWindow: styleBits=" + Integer.toHexString(styleBits)
|
||||
+ ", bounds=" + bounds);
|
||||
}
|
||||
});
|
||||
long windowPtr = nativeCreateNSWindow(viewPtr, 0, styleBits,
|
||||
bounds.x, bounds.y, bounds.width, bounds.height);
|
||||
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
logger.fine("window created: " + Long.toHexString(windowPtr));
|
||||
}
|
||||
ref.set(windowPtr);
|
||||
}
|
||||
});
|
||||
return ref.get();
|
||||
});
|
||||
setPtr(nativeWindowPtr);
|
||||
if (peer != null) { // Not applicable to CWarningWindow
|
||||
peer.setTextured(IS(TEXTURED, styleBits));
|
||||
|
||||
Reference in New Issue
Block a user