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

Action events get delivered to dialog while a modal dialog is being show()n

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 1.1.4
    • client-libs
    • None
    • generic
    • generic

      This is abstracted from HotJava bug 4084990.

      In a bean custom editor, I'm doing field validation when a text item loses
      focus. If a constraint is violated, I post a modal dialog.

      The beanbox has a done button which dismisses the dialog.

      The problem happens (under Solaris, at least) when the user types something
      invalid, then clicks on done _without_ leaving the frame. The "focus lost"
      fires first (as it should), but *after* I call Dialog.show() to show the
      error dialog, the done button of the beanbox gets its action event, causing
      the beanbox to Dialog.dispose(). Now the modal dialog has a disposed parent,
      so the system hangs.

      I've tried to reproduce this in a stand-alone app, but that doesn't exhibit
      the problem. It's attached.

      Currently, I'm working around this problem with the following disgusting
      hack (in sunw.hotjava.bean.PropertiesEditorPanel):

                      // Workaround for bug 4084990: Events get delivered to
                      // the beanbox after our modal dialog show, which can cause
                      // a hang if they press "done". Waiting 100ms for events
                      // to come in then nuking any events on the queue works
                      // around this.
                      try {
                         Thread.sleep(100);
                         java.awt.EventQueue q = java.awt.Toolkit.getDefaultToolkit().
      getSystemEventQueue();
                         while (q.peekEvent() != null) {
                             q.getNextEvent();
                         }
                      } catch (Exception ignored) {
                      }
                      d.show();


      bill.foote@Eng 1997-10-15

            mdavidsosunw Mark Davidson (Inactive)
            bfootesunw Bill Foote (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: