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

adding zero-item Choice to Container causes SIGSEGV



    • Subcomponent:
    • CPU:
    • OS:


      Doing a Component.add(Choice c) when "c" has had no items causes
      a SIGSEGV. This is isn't a useful thing to do, but dumping core isn't a nice
      outcome. Perhaps turning it into a one-choice ("null") button or throwing
      an exception would be a better way to handle it.

      The following is a simple test case:

      import java.awt.*;
       * dumps core with SIGSEGV
      public class ChoiceTest extends Frame {
          Choice c1;
          public ChoiceTest() {
      c1 = new Choice();
      add("North", c1);
          public static void main(String args[]) {
      new ChoiceTest();


      Original bug report (before customer realized they had done no addItems
      in this particular case):

      *** This is a severe problem, is there a known workaround? ***

      In Espresso, we have a number of dialog boxes where the strings on Choice component must be changed, just like list boxes.

      In list boxes, we clear() all strings and then addItem() the new strings.

      In Choice menus, there is no clear() method so we create a new Choice component on the fly. Below is a pruned version of our code. If this is not a known problem or is not imminently reproducable, lets us know, we can fabricate a complete example:

          public void addin(Dlg dlg) {
              cmp.show(false); // hack -just undisplay old one
              cmp = new Choice();
              for ( int ix = 0; ix < num_strs; ix++ )
      // cmp.select(0); // errors, says 0 invalid index!

      ***************** OUTPUT *************************

      Any workaround suggestions:

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

          stackbase=EE13F000, stackpointer=EE13DF20

      Full thread dump:
          "Image Fetcher 3" (TID:0xee8fcd88, sys_thread_t:0xee094de0) prio=8
          "Image Fetcher 2" (TID:0xee8fcd20, sys_thread_t:0xee0b6de0) prio=8
          "Image Fetcher 1" (TID:0xee8fccb8, sys_thread_t:0xee0d8de0) prio=8
          "Image Fetcher 0" (TID:0xee8fcc30, sys_thread_t:0xee0fade0) prio=8
          "duker" (TID:0xee8fc990, sys_thread_t:0xee11cde0) prio=1
          "listener" (TID:0xee8fc968, sys_thread_t:0xee13ede0) prio=1 *current thread*
          "Screen Updater" (TID:0xee8e24b8, sys_thread_t:0xee17ade0) prio=4
          "AWT-Motif" (TID:0xee8e2148, sys_thread_t:0xee19cde0) prio=5
          "AWT-Input" (TID:0xee8e2120, sys_thread_t:0xee1bede0) prio=5
          "thread applet-starter.class" (TID:0xee8e1ee8, sys_thread_t:0xee4bede0) prio=6
          "Finalizer thread" (TID:0xee8df370, sys_thread_t:0xee4f5de0) prio=1
          "Async Garbage Collector" (TID:0xee8df318, sys_thread_t:0xee517de0) prio=1
          "Idle thread" (TID:0xee8df2a0, sys_thread_t:0xee539de0) prio=0
          "clock handler" (TID:0xee8df1f8, sys_thread_t:0xee55bde0) prio=11
          "main" (TID:0xee8df0a0, sys_thread_t:0x745f0) prio=5
      Monitor Cache Dump:
          java.awt.Choice@EE8F29D8/EE95C9B8 (key=0xee8f29d8): monitor owner: "listener"
          java.util.Vector@EE8FCDF0/EE9A06B0 (key=0xee8fcdf0): unowned
          Waiting to be notified:
              "Image Fetcher 1"
              "Image Fetcher 2"
              "Image Fetcher 3"
              "Image Fetcher 0"
          unknown key (key=0xee11cde0): monitor owner: "duker"
          sun.awt.motif.MToolkit@EE8E2108/EE91E210 (key=0xee8e2108): monitor owner: "listener"
          Waiting to enter:
          Waiting to be notified:
          sun.awt.ScreenUpdater@EE8E24B8/EE91EC28 (key=0xee8e24b8): unowned
          Waiting to be notified:
              "Screen Updater"
          unknown key (key=0xee517de0): unowned
          Waiting to be notified:
              "Async Garbage Collector"
          sun.applet.AppletViewerPanel@EE8E1D80/EE91D198 (key=0xee8e1d80): unowned
          Waiting to be notified:
              "thread applet-starter.class"
          Dlg@EE8F1498/EE957498 (key=0xee8f1498): monitor owner: "listener"
      Registered Monitor Dump:
          Finalize me queue lock: unowned
          Waiting to be notified:
              "Finalizer thread"
          Thread queue lock: unowned
          Waiting to be notified:
          Class lock: unowned
          Java stack lock: unowned
          Code rewrite lock: unowned
          Heap lock: unowned
          Has finalization queue lock: unowned
          Monitor IO lock: unowned
          Child death monitor: unowned
          Event monitor: unowned
          I/O monitor: unowned
          Alarm monitor: unowned
          Waiting to be notified:
              "clock handler"
          Sbrk lock: unowned
          Monitor cache lock: unowned
          Monitor registry: monitor owner: "listener"
      Thread Alarm Q:
          sys_thread_t 0xee517de0 [Timeout in 231 ms]

      // Barry Zane Vice President of Technology
      // Applix, Inc 508-870-0300 x226 ###@###.###


          Issue Links



              amfowler Anne Fowler (Inactive)
              duke J. Duke (Inactive)
              0 Vote for this issue
              0 Start watching this issue