classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] FYI: javax.swing.SwingUtilities fixlet


From: Roman Kennke
Subject: [cp-patches] FYI: javax.swing.SwingUtilities fixlet
Date: Fri, 20 May 2005 14:14:37 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204

I committed the attached patch that fixes javax.swing.SwingUtilities.convertPoint(). This method must check the showing property of the source and destination components before calling convertPointTo/FromScreen(). Otherwise an IllegalComponentStateException is thrown. Since that method is called extensivly from the EventQueue, such a failure would kill the EventQueue, effectivly leading to a not-responding application. This has for example been the case when frames have been hidden.

I have checked the behaviour of Sun's implementation when source and destination are not showing. They do exactly what we do now: if one of the components is not showing, it simply returns the input coordinates as return value.

2005-05-20  Roman Kennke  <address@hidden>

       * javax/swing/SwingUtilities.java
       (convertPoint): Check for visibility of source and destination
       before calling convertPointToScreen or convertPointFromScreen.

/Roman

Index: javax/swing/SwingUtilities.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/SwingUtilities.java,v
retrieving revision 1.25
diff -u -r1.25 SwingUtilities.java
--- javax/swing/SwingUtilities.java     19 May 2005 12:37:20 -0000      1.25
+++ javax/swing/SwingUtilities.java     20 May 2005 12:08:17 -0000
@@ -515,8 +515,11 @@
     if (destination == null)
       destination = getRoot(source);
 
-    convertPointToScreen(pt, source);
-    convertPointFromScreen(pt, destination);
+    if (source.isShowing() && destination.isShowing())
+      {
+        convertPointToScreen(pt, source);
+        convertPointFromScreen(pt, destination);
+      }
 
     return pt;
   }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]