< prev index next >

src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java

Print this page

        

@@ -243,14 +243,17 @@
 
         // Find a root TG and attach toolkit thread to it
         ThreadGroup rootTG = AccessController.doPrivileged(
                 (PrivilegedAction<ThreadGroup>) ThreadGroupUtils::getRootThreadGroup);
         if (!startToolkitThread(this, rootTG)) {
-            String name = "AWT-Windows";
+            final String name = "AWT-Windows";
+            AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
             Thread toolkitThread = new Thread(rootTG, this, name, 0, false);
             toolkitThread.setDaemon(true);
             toolkitThread.start();
+                return null;
+            });
         }
 
         try {
             synchronized(this) {
                 while(!inited) {

@@ -262,14 +265,18 @@
         }
 
         // Enabled "live resizing" by default.  It remains controlled
         // by the native system though.
         setDynamicLayout(true);
-
-        areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
+        final String extraButtons = "sun.awt.enableExtraMouseButtons";
+        AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
+            areExtraMouseButtonsEnabled =
+                 Boolean.parseBoolean(System.getProperty(extraButtons, "true"));
         //set system property if not yet assigned
-        System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
+            System.setProperty(extraButtons, ""+areExtraMouseButtonsEnabled);
+            return null;
+        });
         setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
     }
 
     private void registerShutdownHook() {
         AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
< prev index next >