This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Bug (possibly only with xlib, but I doubt it): addNotify not always called for AWT components


I have narrowed down the problem in my earlier posting ("AWT app not working
with latest from cvs, seems to be CardLayout problem").  In my big
application, some components under a CardLayout were not being displayed.
The attached code illustrates the problem.

With my old gcc, which was "gcc (GCC) 3.5.0 20040603 (experimental)", on
linux/x86, the program works OK.  With a recent main branch checkout from
cvs, called "gcc (GCC) 4.0.0 20050108 (experimental)", I had to add the
addNotify call you'll see in there.  I'm using the xlib peers, but I suspect
the problem will occur with other peers as well.

I found that addNotify isn't called for components under the following
conditions:
  - The component is lightweight AWT
  - The component is added to a container with a CardLayout
     (I'm not sure that it has to be CardLayout, but that's what my app was
doing)
  - The container has already been shown on-screen before this component is
added.
That last one's the crux of the thing, I think.  It seems like in Container,
invalidateTree should clear the valid flag, but it doesn't, so validateTree
only works the first time it's called, and components added after that don't
get an addNotify call.  Since addNotify isn't called, the component's peer
is null, and isLightweight returns false, which essentially stops the
component from painting.

Would somebody familiar with the validateTree, invalidateTree and add
methods in Container be able to take a look?

Attachment: CardLayoutTest.java
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]