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

Dialog.show() causes deadlocks if placed in synchronized methods.

XMLWordPrintable

    • x86, sparc
    • solaris_2.4, windows_95

      You should not call show() on file dialogs or modal dialogs from
      synchronized methods, else there is the very serious potential for
      deadlocks during the modal session. This is because a separate thread
      is spawned to handle the modal loop event dispatching (to avoid potential
      security exceptions) and if you've locked your object before going into
      the modal show loop, when the modal thread dipatches events back up in
      your GUI and attempts to call a synchronized method on your object (as
      a result of the event) it will deadlock, since a separate thread had
      locked it before doing the show (and that thread is waiting for the
      modal thread to finish).

      Amy Fowler

            amfowler Anne Fowler (Inactive)
            vssriniv Vijay Srinivasan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: