From d09fdc841452a4d0218aa8d909551ffba3cc034d Mon Sep 17 00:00:00 2001 From: Lyubomir Marinov Date: Mon, 17 Aug 2009 17:42:10 +0000 Subject: [PATCH] Fixes a recently-introduced bug which could take advantage of a race condition and display twice the dialog notifying that the application will not exit when closing the main frame. --- .../communicator/impl/gui/main/MainFrame.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/net/java/sip/communicator/impl/gui/main/MainFrame.java b/src/net/java/sip/communicator/impl/gui/main/MainFrame.java index 9c4a11004..03a2e3c78 100755 --- a/src/net/java/sip/communicator/impl/gui/main/MainFrame.java +++ b/src/net/java/sip/communicator/impl/gui/main/MainFrame.java @@ -114,8 +114,8 @@ public MainFrame() menu = new MainMenu(this); /* - * Before closing the application window saves the current size and - * position through the ConfigurationService. + * If the application is configured to quit when this frame is closed, + * do so. */ this.addWindowListener(new WindowAdapter() { @@ -123,11 +123,6 @@ public void windowClosed(WindowEvent event) { MainFrame.this.windowClosed(event); } - - public void windowClosing(WindowEvent event) - { - MainFrame.this.windowClosing(event); - } }); addComponentListener(new ComponentAdapter() @@ -1417,11 +1412,16 @@ protected void windowClosed(WindowEvent event) } } - /** - * @param event Currently not used + /* + * Overrides SIPCommFrame#windowClosing(WindowEvent). Reflects the closed + * state of this MainFrame in the configuration in order to make it + * accessible to interested parties, displays the warning that the + * application will not quit. */ protected void windowClosing(WindowEvent event) { + super.windowClosing(event); + if (!GuiActivator.getUIService().getExitOnMainWindowClose()) { SwingUtilities.invokeLater(new Runnable()