Fixes a deadlock involving the AWT event dispatching thread.