Browse Source

Fix CME in Maps

tags/v0.10.1
Chris Smith 5 years ago
parent
commit
7698f1465b
2 changed files with 3 additions and 1 deletions
  1. 1
    0
      CHANGELOG
  2. 2
    1
      src/main/kotlin/com/dmdirc/ktirc/model/Maps.kt

+ 1
- 0
CHANGELOG View File

@@ -2,6 +2,7 @@ vNEXT (in development)
2 2
 
3 3
  * Added NickChangeFailed event for when nicknames are in use, banned, etc
4 4
  * Added sendPart method
5
+ * Fix occasional ConcurrentModificationException when adding state
5 6
  * (Internal) Moved message processors into their own package
6 7
 
7 8
 v0.10.0

+ 2
- 1
src/main/kotlin/com/dmdirc/ktirc/model/Maps.kt View File

@@ -1,13 +1,14 @@
1 1
 package com.dmdirc.ktirc.model
2 2
 
3 3
 import com.dmdirc.ktirc.io.CaseMapping
4
+import java.util.*
4 5
 
5 6
 /**
6 7
  * Provides a case-insensitive mapping from a String to some value, according to the provided [CaseMapping].
7 8
  */
8 9
 abstract class CaseInsensitiveMap<T>(private val caseMappingProvider: () -> CaseMapping, private val nameOf: (T) -> String) : Iterable<T> {
9 10
 
10
-    private val values = HashSet<T>()
11
+    private val values = Collections.synchronizedSet(HashSet<T>())
11 12
 
12 13
     /** Gets the value of the given key, if present. */
13 14
     operator fun get(name: String) = values.find { caseMappingProvider().areEquivalent(nameOf(it), name) }

Loading…
Cancel
Save