This makes java.awt.Toolkit.getDefaultToolkit() synchronized to avoid
creating more than one Toolkit accidentally. Yes, I have an app here
that did this.
2006-10-10 Roman Kennke <[EMAIL PROTECTED]>
* java/awt/Toolkit.java
(getDefaultTookit): Make method synchronized to avoid
accidentally creating more than one toolkits from different
threads.
/Roman
Index: java/awt/Toolkit.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/Toolkit.java,v
retrieving revision 1.44
diff -u -1 -5 -r1.44 Toolkit.java
--- java/awt/Toolkit.java 28 Jul 2006 10:07:39 -0000 1.44
+++ java/awt/Toolkit.java 10 Oct 2006 15:35:45 -0000
@@ -535,31 +535,31 @@
* Flushes any buffered data to the screen so that it is in sync with
* what the AWT system has drawn to it.
*/
public abstract void sync();
/**
* Returns an instance of the default toolkit. The default toolkit is
* the subclass of <code>Toolkit</code> specified in the system property
* <code>awt.toolkit</code>, or <code>gnu.java.awt.peer.gtk.GtkToolkit</code>
* if the property is not set.
*
* @return An instance of the system default toolkit.
*
* @throws AWTError If the toolkit cannot be loaded.
*/
- public static Toolkit getDefaultToolkit()
+ public static synchronized Toolkit getDefaultToolkit()
{
if (toolkit != null)
return toolkit;
String toolkit_name = SystemProperties.getProperty("awt.toolkit",
default_toolkit_name);
try
{
ClassLoader cl;
cl = (ClassLoader) AccessController.doPrivileged
(new PrivilegedAction()
{
public Object run()
{
return ClassLoader.getSystemClassLoader();
}