summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Device.java
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Device.java')
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Device.java36
1 files changed, 20 insertions, 16 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Device.java
index ae6e5b3d54..de3319a4a0 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Device.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Device.java
@@ -97,6 +97,8 @@ public abstract class Device implements Drawable {
static int XErrorProc, XIOErrorProc, XNullErrorProc, XNullIOErrorProc;
static Device[] Devices = new Device[4];
+ static final Object CREATE_LOCK = new Object();
+
/* Initialize X and Xt */
static {
/*
@@ -165,23 +167,25 @@ public Device() {
* @see DeviceData
*/
public Device(DeviceData data) {
- if (data != null) {
- display_name = data.display_name;
- application_name = data.application_name;
- application_class = data.application_class;
- tracking = data.tracking;
- debug = data.debug;
- }
- if (tracking) {
- errors = new Error [128];
- objects = new Object [128];
+ synchronized (CREATE_LOCK) {
+ if (data != null) {
+ display_name = data.display_name;
+ application_name = data.application_name;
+ application_class = data.application_class;
+ tracking = data.tracking;
+ debug = data.debug;
+ }
+ if (tracking) {
+ errors = new Error [128];
+ objects = new Object [128];
+ }
+ create (data);
+ init ();
+ register (this);
+
+ /* Initialize the system font slot */
+ systemFont = getSystemFont ();
}
- create (data);
- init ();
- register (this);
-
- /* Initialize the system font slot */
- systemFont = getSystemFont ();
}
void checkCairo() {