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

LightweightDispatcher has race problem with Modal dialogs.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2 P2
    • None
    • 1.1.2
    • client-libs
    • None
    • sparc
    • solaris_2.5.1

      The function LightweightDispatcher.retargetMouseEvent has a timing problem
      when the mouse event causes a modal dialog to show.

      The System.err shows the following message (to our users!)

      Exception occurred during event dispatching:
      java.lang.NullPointerException
      at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:1416)
      at java.awt.LightweightDispatcher.processMouseEvent(Container.java:1329)
      at java.awt.LightweightDispatcher.dispatchEvent(Container.java:1264)
      at java.awt.Container.dispatchEventImpl(Container.java:824)
      at java.awt.Component.dispatchEvent(Component.java:1394)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:64)


      In our case, there is a lightweight component (that is like a button) that
      pops up a FileDialog on the MOUSE_RELEASED event.

      The code in LightWeight dispatcher is:

      mouseEventTarget.dispatchEvent(retargeted);
      // comments omitted
      Cursor c = mouseEventTarget.getCursor();

      The problem (with modal dialogs especially) is that the dispatchEvent is
      blocking with the modal show, and meanwhile another dispatch thread will
      deliver the MOUSE_EXITED event which sets the mouseEventTarget to null,
      causing the NullPointerException.

      If you need an example which will cause this, let me know.

            lbunnisunw Lara Bunni (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: