Ghidra is a software reverse engineering (SRE) framework
GP-1087 - fixed password dialog causing splash screen to close
dragonmacher1c163364b8de
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/DockingWindowManager.java b/Ghidra/Framework/Docking/src/main/java/docking/DockingWindowManager.javaindex b035303a30..28a5a31214 100644--- a/Ghidra/Framework/Docking/src/main/java/docking/DockingWindowManager.java+++ b/Ghidra/Framework/Docking/src/main/java/docking/DockingWindowManager.java@@ -32,6 +32,7 @@ import org.jdom.Element;import docking.action.DockingActionIf;import docking.actions.*;import docking.help.HelpService;+import docking.widgets.PasswordDialog;import generic.util.WindowUtilities;import ghidra.framework.OperatingSystem;import ghidra.framework.Platform;@@ -1764,12 +1765,14 @@ public class DockingWindowManager implements PropertyChangeListener, PlaceholderbestParent = getBestNonModalParent(provider, bestParent);}-// We should no longer need this code. If the above could not find a suitable parent, then-// we can allow a null return value, which should signal to Java to pick a reasonable parent.-// If we put this code back, then make sure the chosen window is not transient.-// if (bestParent == null) {-// bestParent = getActiveNonTransientWindow();-// }+ if (bestParent == null) {+ // Special case: allow transient password dialogs to parent to the active window. This+ // allows the password dialog to stay open over the application splash screen. (This+ // is described in getParentWindow(), which is called above.)+ if (provider instanceof PasswordDialog) {+ bestParent = getJavaActiveWindow();+ }+ }if (bestParent != null && !bestParent.isShowing()) {bestParent = null; // don't let non-showing windows be parentsdiff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/PasswordDialog.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/PasswordDialog.javaindex c5fc3277c8..287d24c7f7 100644--- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/PasswordDialog.java+++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/PasswordDialog.java@@ -52,7 +52,7 @@ public class PasswordDialog extends DialogComponentProvider {* @param choicePrompt namePrompt name prompt to show in the dialog, if null a name will not be prompted for.* @param choices array of choices to present if choicePrompt is not null* @param defaultChoice default choice index- * @param includeAnonymousOption+ * @param includeAnonymousOption true signals to add a checkbox to request anonymous login*/public PasswordDialog(String title, String serverType, String serverName, String passPrompt,String namePrompt, String defaultUserID, String choicePrompt, String[] choices,@@ -118,6 +118,7 @@ public class PasswordDialog extends DialogComponentProvider {String namePrompt, String defaultUserID, boolean hasMessages) {super(title, true);setRememberSize(false);+ setTransient(true);if (hasMessages) {setMinimumSize(300, 150);@@ -198,7 +199,7 @@ public class PasswordDialog extends DialogComponentProvider {passwordField.addKeyListener(new KeyAdapter() {@Overridepublic void keyTyped(KeyEvent e) {- if (e.getModifiers() == 0 && e.getKeyChar() == KeyEvent.VK_ENTER) {+ if (e.getModifiersEx() == 0 && e.getKeyChar() == KeyEvent.VK_ENTER) {okCallback();}}@@ -210,7 +211,7 @@ public class PasswordDialog extends DialogComponentProvider {/*** Display error status- * @param text+ * @param text the text*/public void setErrorText(String text) {super.setStatusText(text, MessageType.ERROR);@@ -218,12 +219,14 @@ public class PasswordDialog extends DialogComponentProvider {/*** Return the password entered in the password field.+ * @return the password chars*/public char[] getPassword() {return passwordField.getPassword();}/**+ * Returns true if anonymous access is requested* @return true if anonymous access requested*/public boolean anonymousAccessRequested() {@@ -235,6 +238,7 @@ public class PasswordDialog extends DialogComponentProvider {/*** Return the user ID entered in the password field+ * @return the user ID entered in the password field*/public String getUserID() {return nameField != null ? nameField.getText().trim() : null;@@ -242,6 +246,7 @@ public class PasswordDialog extends DialogComponentProvider {/*** Returns index of selected choice or -1 if no choice has been made+ * @return index of selected choice or -1 if no choice has been made*/public int getChoice() {if (choiceCB != null) {@@ -252,6 +257,7 @@ public class PasswordDialog extends DialogComponentProvider {/*** Returns true if the OK button was pressed.+ * @return true if the OK button was pressed.*/public boolean okWasPressed() {return okPressed;@@ -263,6 +269,7 @@ public class PasswordDialog extends DialogComponentProvider {close();}+ @Overridepublic void dispose() {if (passwordField != null) {passwordField.setText("");