mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
- Call setFocusable and setEnabled in CMatchUI in the event dispatch thread to try and prevent a crash in this area resulting from threading issues.
This commit is contained in:
@@ -572,16 +572,17 @@ public final class CMatchUI
|
|||||||
//btn1.setFocusable(false);
|
//btn1.setFocusable(false);
|
||||||
//else if (toFocus == btn1)
|
//else if (toFocus == btn1)
|
||||||
//btn2.setFocusable(false);
|
//btn2.setFocusable(false);
|
||||||
btn2.setFocusable(enable2); // order may matter here
|
|
||||||
btn1.setFocusable(enable1);
|
|
||||||
btn2.setEnabled(enable2);
|
|
||||||
btn1.setEnabled(enable1);
|
|
||||||
|
|
||||||
// ensure we don't steal focus from an overlay
|
// ensure we don't steal focus from an overlay
|
||||||
if (toFocus != null) {
|
if (toFocus != null) {
|
||||||
final Runnable focusRoutine = new Runnable() {
|
final Runnable focusRoutine = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public final void run() {
|
public final void run() {
|
||||||
|
btn2.setFocusable(enable2); // order may matter here
|
||||||
|
btn1.setFocusable(enable1);
|
||||||
|
btn2.setEnabled(enable2);
|
||||||
|
btn1.setEnabled(enable1);
|
||||||
|
|
||||||
toFocus.requestFocus(); // focus here even if another window has focus - shouldn't have to do it this way but some popups grab window focus
|
toFocus.requestFocus(); // focus here even if another window has focus - shouldn't have to do it this way but some popups grab window focus
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user