From 72ad7010704c2dbb96a0a850c2bee76a5c64989c Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 21 Nov 2011 14:07:06 +0100 Subject: Initialize JAWTUtil/JAWTJNILibLoader in static initialzier block, not leaving privileged block --- .../classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java | 9 +++++++-- src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src/nativewindow/classes/jogamp') diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java index 2c8538278..36834eb9e 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java @@ -46,8 +46,8 @@ import java.awt.Toolkit; import java.security.AccessController; import java.security.PrivilegedAction; -public class JAWTJNILibLoader extends NWJNILibLoader { - public static void loadAWTImpl() { +public class JAWTJNILibLoader extends NWJNILibLoader { + static { AccessController.doPrivileged(new PrivilegedAction() { public Object run() { // Make sure that awt.dll is loaded before loading jawt.dll. Otherwise @@ -73,4 +73,9 @@ public class JAWTJNILibLoader extends NWJNILibLoader { } }); } + + public static void initSingleton() { + // just exist to ensure static init has been run + } + } diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java index ddf453bab..45b55e46e 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java @@ -109,7 +109,7 @@ public class JAWTUtil { } static { - JAWTJNILibLoader.loadAWTImpl(); + JAWTJNILibLoader.initSingleton(); JAWTJNILibLoader.loadNativeWindow("awt"); headlessMode = GraphicsEnvironment.isHeadless(); -- cgit v1.2.3