From 8cf694c1424277e6358039a964ecd75c54cf9af9 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 26 Nov 2012 18:15:59 +0100 Subject: SWTAccessor: OS_gtk_widget_unrealize optional (SWT 4.3) ; decorate PrivilegedAction for static initSingleton block (SWTAccessor, NewtFactory, NativeWindowFactory) --- .../javax/media/nativewindow/NativeWindowFactory.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src/nativewindow/classes/javax/media') diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java index 179610b25..d7f28a986 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java @@ -148,8 +148,18 @@ public abstract class NativeWindowFactory { } static { - Platform.initSingleton(); - DEBUG = Debug.debug("NativeWindow"); + final boolean[] _DEBUG = new boolean[] { false }; + final String[] _tmp = new String[] { null }; + + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Platform.initSingleton(); // last resort .. + _DEBUG[0] = Debug.debug("NativeWindow"); + _tmp[0] = Debug.getProperty("nativewindow.ws.name", true); + return null; + } } ) ; + + DEBUG = _DEBUG[0]; if(DEBUG) { System.err.println(Thread.currentThread().getName()+" - Info: NativeWindowFactory."); // Thread.dumpStack(); @@ -157,11 +167,10 @@ public abstract class NativeWindowFactory { // Gather the windowing TK first nativeWindowingTypePure = _getNativeWindowingType(); - final String tmp = Debug.getProperty("nativewindow.ws.name", true); - if(null==tmp || tmp.length()==0) { + if(null==_tmp[0] || _tmp[0].length()==0) { nativeWindowingTypeCustom = nativeWindowingTypePure; } else { - nativeWindowingTypeCustom = tmp.intern(); // canonical representation + nativeWindowingTypeCustom = _tmp[0].intern(); // canonical representation } } -- cgit v1.2.3