Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4327282

AbstractButton.getDisabledIcon can cause the VM to hang! (dual-processor box)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P3
    • None
    • 1.3.0
    • client-libs

    Description



      Name: krT82822 Date: 04/03/2000


      4/2/2000, kevin.ryan@eng -- this was NOT reproducible with kestrel-rc2 (1.3.0rc2-Y) on a UNIPROCESSOR NT box.
      However, as the user notes, this may be multi-processor-specific.

      This is equivalent to bug # 4300430, but am filing a new, separate bug, at user's request, to highlight the dual-processor
      nature of this problem.

      -------------------------------------

      java version "1.3.0rc1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc1-T)
      Java HotSpot(TM) Client VM (build 1.3.0rc1-S, mixed mode)

      I've been trying to get your guys attention for a long time about this issue.
      Initially in 1.3beta the problem involved terribly long times to post menus that
      had disabled images for the menu items. Then in 1.3RA the problem changed into a
      full fledged hanging of the VM! The hang is still present in 1.3rc1 and
      I'm afraid it will also be there in the upcoming official release of 1.3. Please
      "same as" bug 4300430 to this new report since this one specifically talks about
      the hang.

      The test app that I've included below easily shows this rather devastating
      problem. Unfortunately it may be that the problem is limited to multi-processor
      NT machines(which is all that my company uses). Also the test app may need to be
      run several times before you get a VM hang(I've always gotten it to happen in
      under 5 trys).

      Here is where the VM is hanging, as gotten by hitting Ctrl-C in the invoking
      shell:


      "AWT-EventQueue-0" prio=7 tid=0x784e10 nid=0xb0 waiting on monitor
      [0x93df000..0x93dfdc8]
      at java.lang.Object.wait(Native Method)
      at java.awt.MediaTracker.waitForID(MediaTracker.java:632)
      at javax.swing.ImageIcon.loadImage(ImageIcon.java:226)
      at javax.swing.ImageIcon.<init>(ImageIcon.java:161)
      at javax.swing.AbstractButton.getDisabledIcon(AbstractButton.java:542)
      at
      javax.swing.plaf.basic.BasicMenuItemUI.paintMenuItem(BasicMenuItemUI.java:561)
      at
      javax.swing.plaf.basic.BasicMenuItemUI.paint(BasicMenuItemUI.java:473)
      at
      javax.swing.plaf.basic.BasicMenuItemUI.update(BasicMenuItemUI.java:469)
      at javax.swing.JComponent.paintComponent(JComponent.java:398)
      at javax.swing.JComponent.paint(JComponent.java:739)
      at javax.swing.JComponent.paintChildren(JComponent.java:523)
      at javax.swing.JComponent.paint(JComponent.java:748)
      at javax.swing.JComponent.paintChildren(JComponent.java:523)
      at javax.swing.JComponent.paint(JComponent.java:748)
      at javax.swing.JComponent.paintChildren(JComponent.java:523)
      at javax.swing.JComponent.paint(JComponent.java:748)
      at javax.swing.JLayeredPane.paint(JLayeredPane.java:546)
      at javax.swing.JComponent.paintChildren(JComponent.java:523)
      at javax.swing.JComponent.paint(JComponent.java:719)
      at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:23)
      at
      sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:54)
      at
      sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:91)
      at java.awt.Container.paint(Container.java:959)
      at sun.awt.RepaintArea.paint(RepaintArea.java:298)
      at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:193)
      at java.awt.Component.dispatchEventImpl(Component.java:2665)
      at java.awt.Container.dispatchEventImpl(Container.java:1212)
      at java.awt.Window.dispatchEventImpl(Window.java:912)
      at java.awt.Component.dispatchEvent(Component.java:2499)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:319)
      at
      java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:103)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:84)

      Here's the code (invoke w/ any arg to use non-disabled menu items):

      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;

      public class DisabledImageHang extends JFrame {
         // ###
         // ### UPDATE THE FOLLOWING PATH FOR YOUR SYSTEM
         // ###
         static final String IMAGES = "d:/jdk1.3rc1/demo/jfc/Notepad/resources/";
         static final String[] NAMES =
         {"cut.gif","copy.gif","paste.gif","open.gif","save.gif"};

         public DisabledImageHang(boolean disable) {
            JMenuBar menuBar;
            JMenu menu;
            JMenuItem menuItem;

            addWindowListener(new WindowAdapter() {
               public void windowClosing(WindowEvent e) {
                  System.exit(0);
               }
            });

            menuBar = new JMenuBar();
            setJMenuBar(menuBar);

            menu = new JMenu("Test");
            menu.setMnemonic('T');
            menuBar.add(menu);

            for (int i=0; i<NAMES.length; i++) {
               menuItem = new JMenuItem("New Item #"+i);
               menuItem.setIcon(new ImageIcon(IMAGES + "/" + NAMES[i]));
               if (disable)
                  menuItem.setEnabled(false);
               menu.add(menuItem);
            }
         }

         public static void main(String[] args) {
            DisabledImageHang window = new
               DisabledImageHang((args.length == 0));

            window.setTitle("Popup w/ Disabled Icons Bug");

            window.setBounds(300, 300, 400, 400);
            window.setVisible(true);
         }
      }
      (Review ID: 102726)
      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              jeff Jeff Dinkins
              kryansunw Kevin Ryan (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: