Browse Source

Fix concurrent modification error when closing channel windows

git-svn-id: http://svn.dmdirc.com/trunk@228 00569f92-eb28-0410-84fd-f71c24880f
tags/0.1
Chris Smith 17 years ago
parent
commit
823e025fd4
1 changed files with 8 additions and 2 deletions
  1. 8
    2
      src/uk/org/ownage/dmdirc/Server.java

+ 8
- 2
src/uk/org/ownage/dmdirc/Server.java View File

@@ -65,6 +65,8 @@ public class Server implements IChannelSelfJoin, IErrorInfo, InternalFrameListen
65 65
     
66 66
     private Raw raw;
67 67
     
68
+    private boolean closing = false;
69
+    
68 70
     /**
69 71
      * Creates a new instance of Server
70 72
      * @param server The hostname/ip of the server to connect to
@@ -86,7 +88,7 @@ public class Server implements IChannelSelfJoin, IErrorInfo, InternalFrameListen
86 88
         MyInfo myInfo = new MyInfo();
87 89
         myInfo.sNickname = Config.getOption("general","defaultnick");
88 90
         myInfo.sAltNickname = Config.getOption("general","alternatenick");
89
-                
91
+        
90 92
         parser = new IRCParser(myInfo, new ServerInfo(server, port, password));
91 93
         
92 94
         try {
@@ -145,13 +147,17 @@ public class Server implements IChannelSelfJoin, IErrorInfo, InternalFrameListen
145 147
     }
146 148
     
147 149
     private void closeChannels() {
150
+        closing = true;
148 151
         for (Channel channel : channels.values()) {
149 152
             channel.close();
150 153
         }
154
+        closing = false;
151 155
     }
152 156
     
153 157
     public void delChannel(String chan) {
154
-        channels.remove(chan);
158
+        if (!closing) {
159
+            channels.remove(chan);
160
+        }
155 161
     }
156 162
     
157 163
     private void addChannel(ChannelInfo chan) {

Loading…
Cancel
Save