2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-28 12:47:43 +00:00

Fix potential concurrency issue

Made the registeredPlugins list CoW since there are multiple threads
iterating and modifying it, potentially at the same time.
This commit is contained in:
Albert Vaca Cintora 2023-10-07 00:36:55 +02:00
parent 6379679e2b
commit 320befcf36

View File

@ -28,6 +28,7 @@ import java.net.MalformedURLException
import java.net.URL
import java.net.URLDecoder
import java.security.MessageDigest
import java.util.concurrent.CopyOnWriteArrayList
/**
* Handles the cache for album art
@ -67,7 +68,7 @@ internal object AlbumArtCache {
/**
* A list of plugins to notify on fetched album art
*/
private val registeredPlugins = ArrayList<MprisPlugin>()
private val registeredPlugins = CopyOnWriteArrayList<MprisPlugin>()
/**
* Initializes the disk cache. Needs to be called at least once before trying to use the cache