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

regression: application crashes if you click on a menu in an inactive frame

XMLWordPrintable

    • b01
    • sparc
    • solaris_2.5.1
    • Not verified


        This bug occurs with JDK1.1.5J, JDK1.1.5FCS, JDK1.1.6L, JDK1.1.6M and
        JDK1.1.6N.
         
        From JDK1.1.5J onwardsn, appletviewer crashes when you try
        to click on a menu of an inactive frame.

        In JDK1.1.4J, appletviewer does not crash, but the inactive frame just
        gains the focus, and the menu items aren't displayed.
         
        Test Case:
         
        b518877.java:
        import java.applet.*;
        import java.awt.*;
        import java.awt.event.*;
        public class b518877
               extends Applet
        {
            private Frame _mFrame1;
            private Frame _mFrame2;
         
            public b518877()
            {
            }
         
            public void start()
            {
                _mFrame1 = new TestFrame("Frame 1");
                _mFrame2 = new TestFrame("Frame 2");
         
                _mFrame1.setBounds(100, 100, 300, 200);
                _mFrame2.setBounds(125, 125, 300, 200);
         
                _mFrame1.validate();
                _mFrame2.validate();
         
                _mFrame1.setVisible(true);
                _mFrame2.setVisible(true);
            }
         
        }
         
        class TestFrame extends Frame
                        implements WindowListener
        {
            private TextField _mField1;
            private TextField _mField2;
            private MenuBar _mMenuBar;
            private Menu _mMenu;
         
            TestFrame(String name)
            {
                super(name);
         
                _mField1 = new TextField();
                _mField2 = new TextField();
         
                add(_mField1, "East");
                add(_mField2, "West");
         
                add(new PopupMenu("dummy"));
         
                addWindowListener(this);
            }
         
            public void windowOpened(WindowEvent e)
            {
            }
         
            public void windowClosing(WindowEvent e)
            {
            }
         
            public void windowClosed(WindowEvent e)
            {
            }
         
            public void windowIconified(WindowEvent e)
            {
            }
         
            public void windowDeiconified(WindowEvent e)
            {
            }
         
            public void windowActivated(WindowEvent e)
            {
                _mMenuBar = new MenuBar();
         
                _mMenu = new Menu("Menu 01");
                _mMenu.add(new MenuItem("Item 01"));
                _mMenu.add(new MenuItem("Item 02"));
                _mMenu.add(new MenuItem("Item 03"));
                _mMenu.add(new MenuItem("Item 04"));
                _mMenu.add(new MenuItem("Item 05"));
                _mMenu.add(new MenuItem("Item 06"));
                _mMenu.add(new MenuItem("Item 07"));
                _mMenu.add(new MenuItem("Item 08"));
                _mMenu.add(new MenuItem("Item 09"));
                _mMenu.add(new MenuItem("Item 10"));
                _mMenuBar.add(_mMenu);
         
                _mMenu = new Menu("Menu 02");
                _mMenu.add(new MenuItem("Item 01"));
                _mMenu.add(new MenuItem("Item 02"));
                _mMenu.add(new MenuItem("Item 03"));
                _mMenu.add(new MenuItem("Item 04"));
                _mMenu.add(new MenuItem("Item 05"));
                _mMenu.add(new MenuItem("Item 06"));
                _mMenu.add(new MenuItem("Item 07"));
                _mMenu.add(new MenuItem("Item 08"));
                _mMenu.add(new MenuItem("Item 09"));
                _mMenu.add(new MenuItem("Item 10"));
                _mMenuBar.add(_mMenu);
         
                _mMenu = new Menu("Menu 03");
                _mMenu.add(new MenuItem("Item 01"));
                _mMenu.add(new MenuItem("Item 02"));
                _mMenu.add(new MenuItem("Item 03"));
                _mMenu.add(new MenuItem("Item 04"));
                _mMenu.add(new MenuItem("Item 05"));
                _mMenu.add(new MenuItem("Item 06"));
                _mMenu.add(new MenuItem("Item 07"));
                _mMenu.add(new MenuItem("Item 08"));
                _mMenu.add(new MenuItem("Item 09"));
                _mMenu.add(new MenuItem("Item 10"));
                _mMenuBar.add(_mMenu);
         
                _mMenu = new Menu("Menu 04");
                _mMenu.add(new MenuItem("Item 01"));
                _mMenu.add(new MenuItem("Item 02"));
                _mMenu.add(new MenuItem("Item 03"));
                _mMenu.add(new MenuItem("Item 04"));
                _mMenu.add(new MenuItem("Item 05"));
                _mMenu.add(new MenuItem("Item 06"));
                _mMenu.add(new MenuItem("Item 07"));
                _mMenu.add(new MenuItem("Item 08"));
                _mMenu.add(new MenuItem("Item 09"));
                _mMenu.add(new MenuItem("Item 10"));
                _mMenuBar.add(_mMenu);
         
                _mMenu = new Menu("Menu 05");
                _mMenu.add(new MenuItem("Item 01"));
                _mMenu.add(new MenuItem("Item 02"));
                _mMenu.add(new MenuItem("Item 03"));
                _mMenu.add(new MenuItem("Item 04"));
                _mMenu.add(new MenuItem("Item 05"));
                _mMenu.add(new MenuItem("Item 06"));
                _mMenu.add(new MenuItem("Item 07"));
                _mMenu.add(new MenuItem("Item 08"));
                _mMenu.add(new MenuItem("Item 09"));
                _mMenu.add(new MenuItem("Item 10"));
                _mMenuBar.add(_mMenu);
         
                setMenuBar(_mMenuBar);
            }
         
            public void windowDeactivated(WindowEvent e)
            {
            }
        }
         
         
        b518877.html:
        <applet code="b518877" width=400 height=400>
        </applet>
         
         
        To reproduce the bug:

        1. Start the appletviewer
        2. Move "Frame 2" around a little bit so that you can see the menus of the
        inactive frame "Frame 1"
        3. Click on any menu of "Frame 1"
        4. appletviewer will crash
         
        A Dr. Watson for Windows NT message box will be generated:
        Exception: access violation(0xc0000005), Address: 0x0000001

        (The hex address for Address will vary from installation to installation)



         
        ingrid.yao@Eng 1998-07-02

        stack trace from Visual C++:
        =============================
        00120751()
        AwtFrame::WmDrawItem(unsigned int 0, tagDRAWITEMSTRUCT & {...}) line 320 + 16 bytes
        AwtComponent::WindowProc(unsigned int 43, unsigned int 0, long 35123872) line 675 + 22 bytes
        AwtComponent::WndProc(void * 0x0008077a, unsigned int 43, unsigned int 0, long 35123872) line 161 + 23 bytes
        USER32! 77e71ab7()
        USER32! 77e888d8()
        NTDLL! 77f7624f()
        USER32! 77e7288d()
        USER32! 77e72918()
        AwtComponent::DefWindowProcA(unsigned int 274, unsigned int 61589, long 2491327) line 776 + 47 bytes
        AwtComponent::WindowProc(unsigned int 274, unsigned int 61589, long 2491327) line 763 + 20 bytes
        AwtComponent::WndProc(void * 0x0008077a, unsigned int 274, unsigned int 61589, long 2491327) line 161 + 23 bytes
        USER32! 77e71ab7()
        USER32! 77e71a77()
        NTDLL! 77f7624f()
        USER32! 77e7288d()
        USER32! 77e72918()
        AwtComponent::DefWindowProcA(unsigned int 161, unsigned int 5, long 2491327) line 776 + 47 bytes
        AwtComponent::WindowProc(unsigned int 161, unsigned int 5, long 2491327) line 763 + 20 bytes
        AwtComponent::WndProc(void * 0x0008077a, unsigned int 161, unsigned int 5, long 2491327) line 161 + 23 bytes
        USER32! 77e71250()

              rkhansunw Robi Khan (Inactive)
              mmuellersunw Marianne Mueller (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: