Преглед изворни кода

Backported:

	rv3090: Fix updater going into a nasty loop if checking is disabled
	rv3048: Fix CME in CommandParser


git-svn-id: http://svn.dmdirc.com/branches/0.5.5@3096 00569f92-eb28-0410-84fd-f71c24880f
remotes/0.5.5
Shane Mc Cormack пре 16 година
родитељ
комит
73062eecb7

+ 14
- 9
src/com/dmdirc/commandparser/parsers/CommandParser.java Прегледај датотеку

@@ -172,11 +172,14 @@ public abstract class CommandParser implements Serializable {
172 172
             builder.append(arg);
173 173
         }
174 174
         
175
-        history.add(new PreviousCommand(builder.toString()));
176
-        
177
-        while (history.size() >
178
-                IdentityManager.getGlobalConfig().getOptionInt("general", "commandhistory", 10)) {
179
-            history.remove(0);
175
+        synchronized(history) {
176
+            history.add(new PreviousCommand(builder.toString()));
177
+
178
+            int historysize = IdentityManager.getGlobalConfig().getOptionInt("general",
179
+                    "commandhistory", 10);
180
+            while (history.size() > historysize) {
181
+                history.remove(0);
182
+            }
180 183
         }
181 184
     }
182 185
     
@@ -189,10 +192,12 @@ public abstract class CommandParser implements Serializable {
189 192
      */
190 193
     public long getCommandTime(final String command) {
191 194
         long res = 0;
192
-        
193
-        for (PreviousCommand pc : history) {
194
-            if (pc.getLine().matches("(?i)" + command)) {
195
-                res = Math.max(res, pc.getTime());
195
+
196
+        synchronized(history) {
197
+            for (PreviousCommand pc : history) {
198
+                if (pc.getLine().matches("(?i)" + command)) {
199
+                    res = Math.max(res, pc.getTime());
200
+                }
196 201
             }
197 202
         }
198 203
         

+ 3
- 0
src/com/dmdirc/updater/UpdateChecker.java Прегледај датотеку

@@ -119,6 +119,9 @@ public final class UpdateChecker implements Runnable {
119 119
         final ConfigManager config = IdentityManager.getGlobalConfig();
120 120
 
121 121
         if (!config.getOptionBool("updater", "enable", true)) {
122
+            IdentityManager.getConfigIdentity().setOption("updater",
123
+                    "lastcheck", String.valueOf((int) (new Date().getTime() / 1000)));
124
+        
122 125
             init();
123 126
             return;
124 127
         }

Loading…
Откажи
Сачувај