mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
HashMap is not thread safe. The existing synchronzed(map) is too small, should be extended to cover the surrounding code.
This commit is contained in:
parent
55d252ae49
commit
ebb2fe458b
1 changed files with 5 additions and 4 deletions
|
@ -112,10 +112,11 @@ public class ArrowBuilder {
|
||||||
* Removes all arrows from the screen.
|
* Removes all arrows from the screen.
|
||||||
*/
|
*/
|
||||||
public void removeAllArrows(UUID gameId) {
|
public void removeAllArrows(UUID gameId) {
|
||||||
if (map.containsKey(gameId)) {
|
synchronized (map) {
|
||||||
Map<Type, List<Arrow>> innerMap = map.get(gameId);
|
if (map.containsKey(gameId)) {
|
||||||
JPanel p = getArrowsPanel(gameId);
|
Map<Type, List<Arrow>> innerMap = map.get(gameId);
|
||||||
synchronized (map) {
|
JPanel p = getArrowsPanel(gameId);
|
||||||
|
|
||||||
if (p != null && p.getComponentCount() > 0) {
|
if (p != null && p.getComponentCount() > 0) {
|
||||||
p.removeAll();
|
p.removeAll();
|
||||||
p.revalidate();
|
p.revalidate();
|
||||||
|
|
Loading…
Reference in a new issue