Create lock before launching the coroutine,
return always a copy of the list and not the real one.
This commit is contained in:
parent
1d236aa6e3
commit
827654c0c1
|
@ -77,7 +77,7 @@ class LegacyPlaylistManager : KoinComponent {
|
|||
|
||||
// Public facing playlist (immutable)
|
||||
val playlist: List<DownloadFile>
|
||||
get() = _playlist
|
||||
get() = _playlist.toList()
|
||||
|
||||
@get:Synchronized
|
||||
val playlistDuration: Long
|
||||
|
|
|
@ -43,8 +43,8 @@ class PlaybackStateSerializer : KoinComponent {
|
|||
) {
|
||||
if (!setup.get()) return
|
||||
|
||||
ioScope.launch {
|
||||
if (lock.tryLock()) {
|
||||
ioScope.launch {
|
||||
try {
|
||||
serializeNow(songs, currentPlayingIndex, currentPlayingPosition)
|
||||
} finally {
|
||||
|
|
Loading…
Reference in New Issue