aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorysuenaga <unknown>2015-12-09 21:24:57 +0900
committerbell-sw <liberica@bell-sw.com>2019-07-22 19:21:54 +0300
commitdc71e483dc008afafa640b2c801d8072a90d1b24 (patch)
tree29829e73be700432bf9ec47c56db94001d749ba4
parent127caf26a0f0cdc9dadf9403bf02b9c290f7eaef (diff)
downloadjdk8u_hotspot-dc71e483dc008afafa640b2c801d8072a90d1b24.tar.gz
8144332: HSDB could not terminate when close button is pushed.
Reviewed-by: jbachorik
-rw-r--r--agent/src/share/classes/sun/jvm/hotspot/HSDB.java18
1 files changed, 12 insertions, 6 deletions
diff --git a/agent/src/share/classes/sun/jvm/hotspot/HSDB.java b/agent/src/share/classes/sun/jvm/hotspot/HSDB.java
index 97726c4e6..30d1f6b95 100644
--- a/agent/src/share/classes/sun/jvm/hotspot/HSDB.java
+++ b/agent/src/share/classes/sun/jvm/hotspot/HSDB.java
@@ -128,10 +128,14 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
}
}
- // close this tool without calling System.exit
- protected void closeUI() {
- workerThread.shutdown();
- frame.dispose();
+ private class CloseUI extends WindowAdapter {
+
+ @Override
+ public void windowClosing(WindowEvent e) {
+ workerThread.shutdown();
+ frame.dispose();
+ }
+
}
public void run() {
@@ -147,7 +151,8 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
frame = new JFrame("HSDB - HotSpot Debugger");
frame.setSize(800, 600);
- frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+ frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
+ frame.addWindowListener(new CloseUI());
JMenuBar menuBar = new JMenuBar();
@@ -210,7 +215,8 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
item = createMenuItem("Exit",
new ActionListener() {
public void actionPerformed(ActionEvent e) {
- closeUI();
+ workerThread.shutdown();
+ frame.dispose();
}
});
item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.ALT_MASK));