Changeset 4458


Ignore:
Timestamp:
2003-06-03T14:04:26+12:00 (21 years ago)
Author:
jmt12
Message:

2030102: If the modal dialog was opened by any thread other than the DispatchThread, then it was being blocked with wait() but never being sent notify(). It does now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/gui/ModalDialog.java

    r4431 r4458  
    4040    /** true if this dialog should be modal, ie block user actions to its owner window, false otherwise. */
    4141    protected boolean modal = false;
    42 
     42    /** true if this dialog is currently waiting some thread. */
     43    protected boolean waiting = false;
    4344    /** Constructor.
    4445     */
     
    119120     */
    120121    public void setVisible (boolean visible) {
     122    ///ystem.err.println("setVisible(" + visible + ")");
    121123    getParent ().setEnabled (!(visible && modal));
    122124    super.setVisible (visible);
    123     if (modal && visible)
     125    if (modal && visible) {
    124126        try {
    125127        if (SwingUtilities.isEventDispatchThread ()) {
     128            ///ystem.err.println("is Event Dispatch Thread.");
    126129            EventQueue theQueue = getToolkit().getSystemEventQueue();
    127130            while (isVisible ()) {
     
    134137            }
    135138            }
     139            ///ystem.err.println("No longer visible - AWT");
    136140                } else synchronized (getTreeLock ()) {
    137             while (isVisible ())
     141            ///ystem.err.println("is other Thread.");
     142            while (isVisible ()) {
    138143            try {
     144                waiting = true;
    139145                getTreeLock().wait();
     146                waiting = false;
    140147            } catch (InterruptedException e) {
     148                ///ystem.err.println("Interrupted!!!");
    141149                break;
    142150            }
     151            ///ystem.err.println("No longer visible - Other");
     152            }
    143153        }
    144154            } catch (Exception ex) {
    145155        ex.printStackTrace();
    146156        }
     157    }
     158    else if(modal && !visible && waiting) {
     159        ///ystem.err.println("Tree lock is: " + getTreeLock());
     160        synchronized(getTreeLock()) {
     161        ///ystem.err.println("Notify!");
     162        getTreeLock().notify();
     163        }
     164    }
    147165    }
    148166   
Note: See TracChangeset for help on using the changeset viewer.