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

Removing menus from PopupMenus on Solaris causes core-dump in JDK 1.1.2 & 1.1.3

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1
    • Resolution: Fixed
    • Affects Version/s: 1.1.2
    • Fix Version/s: 1.1.4
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      1.1.4
    • CPU:
      generic, sparc
    • OS:
      solaris_2.5.1
    • Verification:
      Not verified

      Description


      If you run the provided example and select "Re-build Popup Menu",
      java dumps core.

      I have tried several work-a-rounds, but I have not found any way to
      remove sub-menu items from a popup-menu. Great if you could tell me
      about any work-a-rounds...

      We have waited for 1.1.2 to solve our popup-menu problems and were
      glad so see that the previously reported bug (4039089) in this area is
      solved now. Not so happy about this new one though... :-(

      /Janne

      ###@###.###



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

      public class PopupBug extends Frame
      {
         private Button popupButton;
         private PopupMenu popup;

         public PopupBug()
         {
            super();
            setTitle("Popup Bug");
            setLayout(new FlowLayout());
            
            addWindowListener(
      new WindowAdapter() {
      public void windowClosing(WindowEvent event) {
      System.exit(0);
      }
            });

            popupButton = new Button("Click for popup menu");
            popupButton.addMouseListener(
      new MouseAdapter() {
      public void mousePressed(MouseEvent e) {
      popup.show((Component)e.getSource(), e.getX(), e.getY());
      }
            });
            buildPopupMenu();
            add(popupButton);
            
            Button button = new Button("Re-build Popup Menu");
            button.addActionListener(
      new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
      buildPopupMenu();
      }
            });
            add(button);
            
            pack();
            setVisible(true);
         }

         protected void buildPopupMenu()
         {
            if (popup != null) {
      // if popup menu already created, remove items
      // BUG ALERT: dumps core on Solaris!
      popup.removeAll();
            }
            else {
      // 1'st time, create popup menu
      popup = new PopupMenu("popup");
      popupButton.add(popup);
            }
            

            // Add simple items
            popup.add(new MenuItem("1'st item"));
            popup.add(new MenuItem("2'nd item"));

            // Add sub-menu
            Menu submenu = new Menu("Sub menu");
            submenu.add("Sub-item 1");
            submenu.add("Sub-item 2");
            submenu.add("Sub-item 3");
            popup.add(submenu);
         }


         public static void main(String argv[])
         {
            new PopupBug();
         }
      }

      nasser.nouri@Corp 1997-06-19
      nasser.nouri@Corp 1997-07-21

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              gsaab Georges Saab
              Reporter:
              gsaab Georges Saab
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: