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

Crash in Java v1.1.2 & v1.1.3 (with Popups on Solaris)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P1 P1
    • None
    • 1.1.2
    • client-libs
    • None
    • generic
    • solaris_2.5.1

      If I remove items from a popup menu on Solaris, it crashes the Java VM.
      There is no workaround for this problem.

      Steps to use the test case:

      1. Click right mouse on label. Popup shows up.
      2. Slide over to "Sub Menu". There is nothing underneath.
      3. Release popup.
      4. Click on "Add Sub-Menu Items" button.
      5. Click right mouse on label. Popup shows up.
      6. Slide over to "Sub Menu". There are 3 items underneath.
      7. Relase popup.
      8. Click on "Clear Sub-Menu Items" button.
      9. JDK crashes.

      import java.awt.*;
      import java.applet.*;
      import java.awt.event.*;

      public class PopupMenuTest extends Frame
      implements ActionListener, MouseListener {

      PopupMenu popup;
      Menu submenu_p=new Menu("Sub Menu");
      Label label=new Label("Click on this label to see the popup menu");

      public void init() {
      MenuItem mi;

      setLayout(new BorderLayout());

      popup = new PopupMenu();

      popup.add( submenu_p );
      popup.addSeparator();

      mi = new MenuItem("Add Sub-Menu Items");
      mi.addActionListener( this );
      popup.add(mi);

      mi = new MenuItem("Clear Sub-Menu Items");
      mi.addActionListener( this );
      popup.add(mi);

      Button badd=new Button("Add Sub-Menu Items");
      Button bclear=new Button("Clear Sub-Menu Items");
      badd.addActionListener( this );
      bclear.addActionListener( this );

      label.add(popup);

      enableEvents(AWTEvent.MOUSE_EVENT_MASK);

      label.addMouseListener( this );

      add( "West", badd );
      add( "East", bclear );
      add( "South", label);

      setLocation(300, 300);
      pack();
      }

      public void processMouseEvent(MouseEvent e) {

      if (e.isPopupTrigger()) {
      popup.show(e.getComponent(), e.getX(), e.getY());
      }
      super.processMouseEvent(e);
      }

      public void mouseClicked(MouseEvent e) { processMouseEvent(e); }
      public void mousePressed(MouseEvent e) { processMouseEvent(e); }
      public void mouseReleased(MouseEvent e) { processMouseEvent(e); }
      public void mouseEntered(MouseEvent e) { processMouseEvent(e); }
      public void mouseExited(MouseEvent e) { processMouseEvent(e); }

      public void actionPerformed(ActionEvent e) {
      String command = e.getActionCommand();

      if (command.equals("Add Sub-Menu Items")) {
      submenu_p.add( new MenuItem("Item 1") );
      submenu_p.add( new MenuItem("Item 2") );
      submenu_p.add( new MenuItem("Item 3") );
      }
      else if (command.equals("Clear Sub-Menu Items")) {
      //
      // THIS METHOD CRASHES THE JVM ON SOLARIS
      //
      submenu_p.removeAll();
      }
      }

      public static void main( String argv[] )
      {
      PopupMenuTest pt=new PopupMenuTest();
      pt.init();
      pt.show();
      }
      }

      nasser.nouri@Corp 1997-06-16

            gsaab Georges Saab
            nnouri Nasser Nouri
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: