# HG changeset patch # User ysuenaga # Date 1449663897 -32400 # Node ID d7725e7f76b150e6a466e5cb1777cfec676db420 # Parent b4013c3f68077f20d89432b335c89431ba8f09a7 8144332: HSDB could not terminate when close button is pushed. Reviewed-by: jbachorik diff -r b4013c3f6807 -r d7725e7f76b1 hotspot/agent/src/share/classes/sun/jvm/hotspot/HSDB.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/HSDB.java Wed Dec 09 23:17:21 2015 +0900 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/HSDB.java Wed Dec 09 21:24:57 2015 +0900 @@ -125,10 +125,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() { @@ -144,7 +148,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(); @@ -207,7 +212,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));