Author: jflesch
Date: 2007-07-01 21:42:36 +0000 (Sun, 01 Jul 2007)
New Revision: 13868

Modified:
   trunk/apps/Thaw/src/thaw/core/Core.java
   trunk/apps/Thaw/src/thaw/core/MainWindow.java
   trunk/apps/Thaw/src/thaw/plugins/TrayIcon.java
Log:
Prevent a plugin from making the main window visible again while Thaw is 
stopping

Modified: trunk/apps/Thaw/src/thaw/core/Core.java
===================================================================
--- trunk/apps/Thaw/src/thaw/core/Core.java     2007-07-01 21:27:59 UTC (rev 
13867)
+++ trunk/apps/Thaw/src/thaw/core/Core.java     2007-07-01 21:42:36 UTC (rev 
13868)
@@ -48,6 +48,8 @@

        private static final Random RANDOM = new Yarrow();

+       private boolean isStopping = false;
+
        // MDNS stuffs
        private MDNSDiscovery discovery;

@@ -55,6 +57,7 @@
         * Creates a core, but do nothing else (no initialization).
         */
        public Core() {
+               isStopping = false;
                Logger.info(this, "Thaw, version "+Main.VERSION, true);
                Logger.info(this, "2006(c) Freenet project", true);
                Logger.info(this, "Released under GPL license version 2 or 
later (see http://www.fsf.org/licensing/licenses/gpl.html)", true);
@@ -527,6 +530,8 @@
         * @see #exit()
         */
        public void exit(boolean force) {
+               isStopping = true;
+
                if(!force) {
                        if(!canDisconnect()) {
                                if(!askDeconnectionConfirmation())
@@ -708,4 +713,8 @@
                return RANDOM;
        }

+
+       public boolean isStopping() {
+               return isStopping;
+       }
 }

Modified: trunk/apps/Thaw/src/thaw/core/MainWindow.java
===================================================================
--- trunk/apps/Thaw/src/thaw/core/MainWindow.java       2007-07-01 21:27:59 UTC 
(rev 13867)
+++ trunk/apps/Thaw/src/thaw/core/MainWindow.java       2007-07-01 21:42:36 UTC 
(rev 13868)
@@ -227,7 +227,8 @@
         * Make the window visible or not.
         */
        public void setVisible(final boolean v) {
-               mainWindow.setVisible(v);
+               if (!v || !core.isStopping())
+                       mainWindow.setVisible(v);
        }



Modified: trunk/apps/Thaw/src/thaw/plugins/TrayIcon.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/TrayIcon.java      2007-07-01 21:27:59 UTC 
(rev 13867)
+++ trunk/apps/Thaw/src/thaw/plugins/TrayIcon.java      2007-07-01 21:42:36 UTC 
(rev 13868)
@@ -44,6 +44,7 @@
        public final static int DIALOG_X = 300;
        public final static int DIALOG_Y = 500;

+
        public TrayIcon() {

        }
@@ -65,7 +66,7 @@


        public boolean stop() {
-               core.getMainWindow().addWindowListener(this);
+               core.getMainWindow().removeWindowListener(this);
                icon.removeMouseListener(this);

                icon.setVisible(false);


Reply via email to