Thomas Fitzsimmons wrote: > On Wed, 2005-06-29 at 15:14 +0200, Jeroen Frijters wrote: > > Hi, > > > > Can someone who is more up to speed with AWT please take a > > look at the attached patch? While running some AWT code I got > > a ClassCastException in this code and while I didn't quite > > understand the point of the code (or why it failed), it looked > > to me as if the logic was wrong. It tries to find the toplevel > > window, but if it doesn't find it, it still goes > > ahead and casts the component to a window. > > What is the component that is being cast to a window that causes the > ClassCastException? This code assumes that target is either > a window or > packed in a window. If that assumption holds, then the only time that > parent == null is when target is a window with a null parent. In this > case, the while loop will fall through and toplevel will be assigned > target. > > Maybe a focus event is being delivered to a component that isn't yet > packed in a window, or that has just been removed from a > window? In any case, I'd be interested to know what components are > involved.
My guess is that the focus event is delivered to a component that is removed from a window. This could very well be due to a bug in my AWT peers, but I still believe the current code is obviously wrong, I just don't know what the best fix is. Unfortunately I only saw this problem in a large non-free application and I don't really have a clue on how to reproduce this. Regards, Jeroen _______________________________________________ Classpath-patches mailing list [email protected] http://lists.gnu.org/mailman/listinfo/classpath-patches
