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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user