mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 18:29:37 +02:00
Fixed potential timing-based stack trace
This commit is contained in:
parent
4066f640cb
commit
c8626eec1d
1 changed files with 7 additions and 2 deletions
|
@ -204,13 +204,18 @@ public abstract class ComponentProvider implements HelpDescriptor, ActionContext
|
||||||
// Default implementation
|
// Default implementation
|
||||||
public void requestFocus() {
|
public void requestFocus() {
|
||||||
|
|
||||||
|
JComponent component = getComponent();
|
||||||
|
if (component == null) {
|
||||||
|
return; // this shouldn't happen; this implies we have been disposed
|
||||||
|
}
|
||||||
|
|
||||||
KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
|
KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
|
||||||
Component focusOwner = kfm.getFocusOwner();
|
Component focusOwner = kfm.getFocusOwner();
|
||||||
if (focusOwner != null && SwingUtilities.isDescendingFrom(focusOwner, getComponent())) {
|
if (focusOwner != null && SwingUtilities.isDescendingFrom(focusOwner, component)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
getComponent().requestFocus();
|
component.requestFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue