Wed, 09 Dec 2015 21:24:57 +0900
8144332: HSDB could not terminate when close button is pushed.
Reviewed-by: jbachorik
agent/src/share/classes/sun/jvm/hotspot/HSDB.java | file | annotate | diff | comparison | revisions |
1.1 --- a/agent/src/share/classes/sun/jvm/hotspot/HSDB.java Tue Apr 30 17:42:33 2019 +0200 1.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/HSDB.java Wed Dec 09 21:24:57 2015 +0900 1.3 @@ -128,10 +128,14 @@ 1.4 } 1.5 } 1.6 1.7 - // close this tool without calling System.exit 1.8 - protected void closeUI() { 1.9 - workerThread.shutdown(); 1.10 - frame.dispose(); 1.11 + private class CloseUI extends WindowAdapter { 1.12 + 1.13 + @Override 1.14 + public void windowClosing(WindowEvent e) { 1.15 + workerThread.shutdown(); 1.16 + frame.dispose(); 1.17 + } 1.18 + 1.19 } 1.20 1.21 public void run() { 1.22 @@ -147,7 +151,8 @@ 1.23 1.24 frame = new JFrame("HSDB - HotSpot Debugger"); 1.25 frame.setSize(800, 600); 1.26 - frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); 1.27 + frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); 1.28 + frame.addWindowListener(new CloseUI()); 1.29 1.30 JMenuBar menuBar = new JMenuBar(); 1.31 1.32 @@ -210,7 +215,8 @@ 1.33 item = createMenuItem("Exit", 1.34 new ActionListener() { 1.35 public void actionPerformed(ActionEvent e) { 1.36 - closeUI(); 1.37 + workerThread.shutdown(); 1.38 + frame.dispose(); 1.39 } 1.40 }); 1.41 item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.ALT_MASK));