From 46e270339b6948c90b821a44e5912a5936337359 Mon Sep 17 00:00:00 2001 From: dragonmacher <48328597+dragonmacher@users.noreply.github.com> Date: Fri, 5 Jul 2019 09:16:58 -0400 Subject: [PATCH] GT-2951 - fixed exception when closing Reference Editor dialog with an active edit in the table --- .../core/references/EditReferencesProvider.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/EditReferencesProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/EditReferencesProvider.java index c9b8cafe75..b883b22de3 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/EditReferencesProvider.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/EditReferencesProvider.java @@ -561,6 +561,9 @@ public class EditReferencesProvider extends ComponentProviderAdapter @Override public void closeComponent() { + + // end any table editing; this prevents exceptions on focus changes when closing this editor + refsTable.editingStopped(new ChangeEvent(refsTable)); super.closeComponent(); plugin.providerClosed(this); } @@ -895,7 +898,7 @@ public class EditReferencesProvider extends ComponentProviderAdapter comboBox.addItem(rt); } if (selectedIndex < 0) { - comboBox.insertItemAt(value, 0); + comboBox.insertItemAt((RefType) value, 0); selectedIndex = 0; } comboBox.setSelectedIndex(selectedIndex); @@ -904,18 +907,12 @@ public class EditReferencesProvider extends ComponentProviderAdapter } } - private class CellEditComboBox extends JComboBox { + private class CellEditComboBox extends JComboBox { - /** - * Constructor for MemRefComboBox. - */ public CellEditComboBox() { super(); } - /** - * @see javax.swing.JComboBox#setSelectedIndex(int) - */ @Override public void setSelectedIndex(int anIndex) { if (refsTable.getRowCount() == 0) {