diff options
author | Silenio Quarti <silenio> | 2005-05-02 20:34:07 +0000 |
---|---|---|
committer | Silenio Quarti <silenio> | 2005-05-02 20:34:07 +0000 |
commit | e0a7cac092acc69b52668428509d14cbaf5ae176 (patch) | |
tree | d6888be3733d9f3fe96f031baa828d4347048791 | |
parent | e842a3c701cf3040202dbe363ff026b791322937 (diff) | |
download | eclipse.platform.swt-e0a7cac092acc69b52668428509d14cbaf5ae176.tar.gz eclipse.platform.swt-e0a7cac092acc69b52668428509d14cbaf5ae176.tar.xz eclipse.platform.swt-e0a7cac092acc69b52668428509d14cbaf5ae176.zip |
93294
5 files changed, 82 insertions, 62 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/Device.java index 6570eb1f63..1a7384ed3d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/Device.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/Device.java @@ -50,6 +50,8 @@ public abstract class Device implements Drawable { Callback drawPatternCallback, axialShadingCallback; int drawPatternProc, axialShadingProc; + final static Object CREATE_OBJECT = new Object(); + /* * TEMPORARY CODE. When a graphics object is * created and the device parameter is null, @@ -108,15 +110,17 @@ public Device() { * @see DeviceData */ public Device(DeviceData data) { - if (data != null) { - debug = data.debug; - tracking = data.tracking; - } - create (data); - init (); - if (tracking) { - errors = new Error [128]; - objects = new Object [128]; + synchronized (CREATE_OBJECT) { + if (data != null) { + debug = data.debug; + tracking = data.tracking; + } + create (data); + init (); + if (tracking) { + errors = new Error [128]; + objects = new Object [128]; + } } } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java index d8f0d5e0b2..e714f4b78e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java @@ -69,6 +69,8 @@ public abstract class Device implements Drawable { int /*long*/ emptyTab; + static final Object CREATE_LOCK = new Object(); + /* * TEMPORARY CODE. When a graphics object is * created and the device parameter is null, @@ -127,20 +129,22 @@ public Device() { * @see DeviceData */ public Device(DeviceData data) { - if (data != null) { - debug = data.debug; - tracking = data.tracking; - } - if (tracking) { - errors = new Error [128]; - objects = new Object [128]; + synchronized (CREATE_LOCK) { + if (data != null) { + debug = data.debug; + tracking = data.tracking; + } + 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() { 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() { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Device.java index 080bcc925e..2708825e46 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Device.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Device.java @@ -34,6 +34,8 @@ public abstract class Device implements Drawable { byte[] systemFont; + static final Object CREATE_LOCK = new Object(); + /* * TEMPORARY CODE. When a graphics object is * created and the device parameter is null, @@ -89,19 +91,21 @@ public Device() { * @see DeviceData */ public Device(DeviceData data) { - if (data != null) { - debug = data.debug; - tracking = data.tracking; - } - create (data); - init (); - if (tracking) { - errors = new Error [128]; - objects = new Object [128]; + synchronized (CREATE_LOCK) { + if (data != null) { + debug = data.debug; + tracking = data.tracking; + } + create (data); + init (); + if (tracking) { + errors = new Error [128]; + objects = new Object [128]; + } + + /* Initialize the system font slot */ + systemFont = getSystemFont ().handle; } - - /* Initialize the system font slot */ - systemFont = getSystemFont ().handle; } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java index 2994faf998..912e7ee7cc 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java @@ -61,6 +61,8 @@ public abstract class Device implements Drawable { boolean disposed; + final static Object CREATE_LOCK = new Object(); + /* * TEMPORARY CODE. When a graphics object is * created and the device parameter is null, @@ -119,19 +121,21 @@ public Device() { * @see DeviceData */ public Device(DeviceData data) { - if (data != null) { - debug = data.debug; - tracking = data.tracking; - } - create (data); - init (); - if (tracking) { - errors = new Error [128]; - objects = new Object [128]; + synchronized (CREATE_LOCK) { + if (data != null) { + debug = data.debug; + tracking = data.tracking; + } + create (data); + init (); + if (tracking) { + errors = new Error [128]; + objects = new Object [128]; + } + + /* Initialize the system font slot */ + systemFont = getSystemFont().handle; } - - /* Initialize the system font slot */ - systemFont = getSystemFont().handle; } /** |