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

Adding an empty Choice to a gridbag causes a segmentation violation

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      sparc
    • OS:
      generic

      Description

      Simple:
      1) Create a gridbag.
      2) Add a Choice control to it.
      3) At runtime you get the segmentation fault shown below:

      CODE TO REPRODUCE:

      ******* QuickTest.html *************************************************

      <applet code="QuickTest" width=200 height=50> </applet>

      ******* QuickTest.java *************************************************

      import java.awt.*;
      import java.lang.*;
      import java.applet.*;

      public class QuickTest extends Applet {

        Choice testChoice;
        Frame theFrame;

        public void init() {

          theFrame = new Frame();

          Panel topPanel = new Panel();

          GridBagLayout gridbag = new GridBagLayout();
          GridBagConstraints gbC = new GridBagConstraints();
          Component component = null;

          topPanel.setLayout(gridbag);

          // Backup id Choice
          clear_constraints(gbC);
          gbC.gridx = 0;
          gbC.gridy = 0;
          gbC.anchor = GridBagConstraints.SOUTHWEST;
          testChoice = new Choice();
          component = testChoice;
          // VVVVVVVV Commenting out this line causes core dump VVVVVVV
          // ((Choice)component).addItem("This is a test");
          // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          gridbag.setConstraints(component, gbC);
          topPanel.add(component);
          System.out.println("DEBUG - added...");

          theFrame.add("Center", topPanel);
          theFrame.pack();
          theFrame.resize(200,200);
          theFrame.show();
        }

          public void clear_constraints(GridBagConstraints gbConstraints) {
            gbConstraints.gridx = -1;
            gbConstraints.gridy = -1;
            gbConstraints.gridwidth = 1;
            gbConstraints.gridheight = 1;
            gbConstraints.weightx = 0;
            gbConstraints.weighty = 0;
            gbConstraints.fill = GridBagConstraints.NONE;
            gbConstraints.anchor = GridBagConstraints.CENTER;
          }
      }


      ******* SEGMENTATION VIOLATION: ********************************************

      SIGSEGV 11* segmentation violation
          si_signo [11]: SIGSEGV 11* segmentation violation
          si_errno [0]: Error 0
          si_code [1]: SEGV_ACCERR [addr: 0xfffffffc]

              stackbase=EF461000, stackpointer=EF45FE68

      Full thread dump:
          "Screen Updater" (TID:0xee3033a0, sys_thread_t:0xef0d0de0) prio=4
              java.lang.Object.wait(Object.java)
              sun.awt.ScreenUpdater.nextEntry(ScreenUpdater.java:75)
              sun.awt.ScreenUpdater.run(ScreenUpdater.java:95)
          "AWT-Motif" (TID:0xee303030, sys_thread_t:0xef100de0) prio=5
              java.awt.Window.postEvent(Window.java:169)
              sun.awt.motif.MFramePeer.handleMoved(MFramePeer.java:124)
              java.lang.Thread.run(Thread.java)
          "AWT-Input" (TID:0xee303008, sys_thread_t:0xef130de0) prio=5
          "thread applet-QuickTest" (TID:0xee302e48, sys_thread_t:0xef460de0) prio=6 *current thread*
              sun.awt.motif.MChoicePeer.initialize(MChoicePeer.java:35)
              sun.awt.motif.MComponentPeer.<init>(MComponentPeer.java:87)
              sun.awt.motif.MChoicePeer.<init>(MChoicePeer.java:40)
              sun.awt.motif.MToolkit.createChoice(MToolkit.java:81)
              java.awt.Choice.addNotify(Choice.java:55)
              java.awt.Container.addNotify(Container.java:363)
              java.awt.Panel.addNotify(Panel.java:47)
              java.awt.Container.addNotify(Container.java:363)
              java.awt.Window.addNotify(Window.java:72)
              java.awt.Frame.addNotify(Frame.java:87)
              java.awt.Window.pack(Window.java:83)
              QuickTest.init(QuickTest.java:38)
              sun.applet.AppletPanel.run(AppletPanel.java:243)
              java.lang.Thread.run(Thread.java)
          "Finalizer thread" (TID:0xee3003b0, sys_thread_t:0xef490de0) prio=1
          "Async Garbage Collector" (TID:0xee300368, sys_thread_t:0xef4c0de0) prio=1
          "Idle thread" (TID:0xee300320, sys_thread_t:0xef4f0de0) prio=0
          "clock handler" (TID:0xee3001f8, sys_thread_t:0xef5b0de0) prio=11
          "main" (TID:0xee3000a0, sys_thread_t:0x83f68) prio=5
      Monitor Cache Dump:
          unknown key (key=0xef4c0de0): unowned
              Waiting to be notified:
                  "Async Garbage Collector"
          sun.awt.motif.MToolkit@EE302FF0/EE33F7E8 (key=0xee302ff0): monitor owner: "thread applet-QuickTest"
              Waiting to be notified:
                  "AWT-Input"
          java.awt.Frame@EE303778/EE341708 (key=0xee303778): monitor owner: "thread applet-QuickTest"
          java.awt.Choice@EE303808/EE341B40 (key=0xee303808): monitor owner: "thread applet-QuickTest"
          java.awt.Panel@EE303790/EE3417A8 (key=0xee303790): monitor owner: "thread applet-QuickTest"
          sun.awt.motif.MFramePeer@EE3030A8/EE33FA60 (key=0xee3030a8): monitor owner: "AWT-Motif"
          sun.awt.ScreenUpdater@EE3033A0/EE3401F8 (key=0xee3033a0): unowned
              Waiting to be notified:
                  "Screen Updater"
      Registered Monitor Dump:
          unowned
              Waiting to be notified:
                  Finalize me queue lock: "Finalizer thread"
          unowned
              Waiting to be notified:
                  Thread queue lock: "main"
          unowned
          unowned
          unowned
          unowned
          unowned
          unowned
          unowned
          unowned
          unowned
          unowned
              Waiting to be notified:
                  Class lock: Java stack lock: Code rewrite lock: Heap lock: Has finalization queue lock: Monitor IO lock: Child death monitor: Event monitor: I/O monitor: Alarm monitor: "clock handler"
          unowned
          unowned
          monitor owner: "thread applet-QuickTest"
      Thread Alarm Q:
          sys_thread_t 0xef4c0de0 [Timeout in 757 ms]
          Sbrk lock: Monitor cache lock: Monitor registry: Abort (core dumped)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              amfowler Anne Fowler (Inactive)
              Reporter:
              duke J. Duke (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: