Fixed potential deadlock in swing event code when opening windows.