[gui][PATCH] AWTEvent.toString fix
Thomas Fitzsimmons
fitzsim@redhat.com
Fri May 14 02:49:00 GMT 2004
Hi,
This patch fixes AWTEvent's toString method to print the event source's
name, rather than its value. This change eliminates a deadlock when
printing events from within EventQueue's postEvent method. It also
makes our event output more like Sun's.
postEvent is called from the peers while the GDK global lock is held.
Some Components, from their toString methods, call peer methods that
attempt to obtain the GDK global lock. When an attempt is made to print
one of those Components, the result is a deadlock, since
gdk_threads_enter is not reentrant.
Patch committed to the java-gui-branch.
Tom
2004-05-13 Thomas Fitzsimmons <fitzsim@redhat.com>
* java/awt/AWTEvent.java (toString): Print source's name rather
than the source itself.
Index: java/awt/AWTEvent.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/AWTEvent.java,v
retrieving revision 1.9
diff -u -r1.9 AWTEvent.java
--- java/awt/AWTEvent.java 9 Aug 2002 04:26:13 -0000 1.9
+++ java/awt/AWTEvent.java 12 May 2004 18:29:26 -0000
@@ -231,15 +231,15 @@
}
/**
- * Returns a string representation of this event. This is in the format
- * <code>getClass().getName() + '[' + paramString() + "] on "
- * + source</code>.
+ * Create a string that represents this event in the format
+ * <code>classname[eventstring] on sourcecomponentname</code>.
*
- * @return a string representation of this event
+ * @return a string representing this event
*/
- public String toString()
+ public String toString ()
{
- return getClass().getName() + "[" + paramString() + "] on " + source;
+ return getClass ().getName () + "[" + paramString () + "] on "
+ + ((Component) source).getName ();
}
/**
More information about the Java-patches
mailing list