2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-31 06:05:12 +00:00

Fix ConcurrentModificationException when device disconnects while iterating

This commit is contained in:
Albert Vaca Cintora
2023-04-20 12:01:53 +02:00
parent c250d2c674
commit e56f73da83

View File

@@ -67,8 +67,10 @@ public class SystemVolumePlugin extends Plugin {
Log.e("KDEConnect", "Exception", e);
}
for (SinkListener l : listeners) {
l.sinksChanged();
synchronized(listeners) {
for (SinkListener l : listeners) {
l.sinksChanged();
}
}
} else {
@@ -140,11 +142,15 @@ public class SystemVolumePlugin extends Plugin {
}
void addSinkListener(SinkListener listener) {
listeners.add(listener);
synchronized(listeners) {
listeners.add(listener);
}
}
void removeSinkListener(SinkListener listener) {
listeners.remove(listener);
synchronized(listeners) {
listeners.remove(listener);
}
}
}