mirror of
https://github.com/ultrasonic/ultrasonic
synced 2025-02-18 04:30:48 +01:00
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)
|
// Public facing playlist (immutable)
|
||||||
val playlist: List<DownloadFile>
|
val playlist: List<DownloadFile>
|
||||||
get() = _playlist
|
get() = _playlist.toList()
|
||||||
|
|
||||||
@get:Synchronized
|
@get:Synchronized
|
||||||
val playlistDuration: Long
|
val playlistDuration: Long
|
||||||
|
@ -43,8 +43,8 @@ class PlaybackStateSerializer : KoinComponent {
|
|||||||
) {
|
) {
|
||||||
if (!setup.get()) return
|
if (!setup.get()) return
|
||||||
|
|
||||||
ioScope.launch {
|
|
||||||
if (lock.tryLock()) {
|
if (lock.tryLock()) {
|
||||||
|
ioScope.launch {
|
||||||
try {
|
try {
|
||||||
serializeNow(songs, currentPlayingIndex, currentPlayingPosition)
|
serializeNow(songs, currentPlayingIndex, currentPlayingPosition)
|
||||||
} finally {
|
} finally {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user