# HG changeset patch # User ysuenaga # Date 1449663897 -32400 # Node ID 1ebcc366ee626e89638ba6da01b4e8776c4b5fe1 # Parent 7cbcb271bad78b1acad78550b7450a312baafb36 8144332: HSDB could not terminate when close button is pushed. Reviewed-by: jbachorik diff -r 7cbcb271bad7 -r 1ebcc366ee62 agent/src/share/classes/sun/jvm/hotspot/HSDB.java --- a/agent/src/share/classes/sun/jvm/hotspot/HSDB.java Tue Apr 30 17:42:33 2019 +0200 +++ b/agent/src/share/classes/sun/jvm/hotspot/HSDB.java Wed Dec 09 21:24:57 2015 +0900 @@ -128,10 +128,14 @@ } } - // 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 @@ 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 @@ 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));