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

In NT, when show GUI(awt) in a thread, system will crash.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P2
    • None
    • 1.2.2
    • client-libs
    • x86
    • windows_nt

    Description

      JDK: 1.2.2-D
      OS: NT4.0
      Locale: zh_CN

      If we show GUI, like a frame, may contain a button or Choice in it, in a
      thread that created by us, system will crash.
      Following is a program to reproduce it:

      ============================CheckThread.java================================
      import java.awt.*;
      import java.awt.event.*;
      import java.io.*;

      public class CheckThread {
          LittleThread myThread;

          public static void main(String args[]) {
      new CheckThread();
          }

          public CheckThread() {
              myThread = new LittleThread();
              myThread.start();
          }

      class LittleThread implements Runnable {
          
          Choice choice1;
          int itemCount = 0;
          boolean PAUSE = false;
          Thread driver = null;

          public LittleThread() {
              Frame f = new Frame("Check Choice");
              f.setLayout(new BorderLayout());
              choice1 = new Choice();
              f.add(choice1, BorderLayout.CENTER);
              f.pack();
              f.show();
          }

          public void start() {
      if (driver == null) {
      driver = new Thread(this, "");
      driver.start();
      }
          }


          public void run() {
              while (true) {
                  if (choice1 != null && itemCount < 40) {
                      choice1.add("I am Choice, yes I am : " + itemCount * itemCount);
                      itemCount ++;
                  }
                  if (itemCount >= 20 && choice1 != null && choice1.getItemCount() > 0) {
                      choice1.removeAll();
                      itemCount = 0;
                  }
                  try {
                      Thread.sleep(1000);
                  } catch (Exception ex) {
                  }
              }
          }
      }

      }
      ================================================================================

      Run this program in NT4.0 (Simplified Chinese Version),
      it will call java to crash, I am not sure whether
      it exists in NT4.0 English version.


      jim.hu@prc 1999-01-25

      Attachments

        Activity

          People

            ehawkessunw Eric Hawkes (Inactive)
            jhusunw Jim Hu (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: