From 360e4bc1cb9be9936a9f0108b8121657f2822ab6 Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Wed, 20 Mar 2019 22:12:53 +0100 Subject: [PATCH] Fix ConcurrentModificationException When onPacketReceived was called at the same time as getSinks, because getSinks uses .values() and onPacketReceived does .put() --- .../Plugins/SystemvolumePlugin/SystemvolumePlugin.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/org/kde/kdeconnect/Plugins/SystemvolumePlugin/SystemvolumePlugin.java b/src/org/kde/kdeconnect/Plugins/SystemvolumePlugin/SystemvolumePlugin.java index 01b81b22..0517dd73 100644 --- a/src/org/kde/kdeconnect/Plugins/SystemvolumePlugin/SystemvolumePlugin.java +++ b/src/org/kde/kdeconnect/Plugins/SystemvolumePlugin/SystemvolumePlugin.java @@ -30,7 +30,7 @@ import org.kde.kdeconnect_tp.R; import java.util.ArrayList; import java.util.Collection; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; @PluginFactory.LoadablePlugin public class SystemvolumePlugin extends Plugin { @@ -42,11 +42,11 @@ public class SystemvolumePlugin extends Plugin { void sinksChanged(); } - private final HashMap sinks; + private final ConcurrentHashMap sinks; private final ArrayList listeners; public SystemvolumePlugin() { - sinks = new HashMap<>(); + sinks = new ConcurrentHashMap<>(); listeners = new ArrayList<>(); }