Fix an exception when removeIncompleteTracksFromPlaylist() could be called on the wrong thread.

This commit is contained in:
tzugen 2023-07-13 13:19:03 +02:00
parent 7209779b64
commit 8d43b935ab
No known key found for this signature in database
GPG Key ID: 61E9C34BC10EC930

View File

@ -182,6 +182,8 @@ class MediaPlayerManager(
createMediaController(onCreated)
rxBusSubscription += RxBus.activeServerChangingObservable.subscribe { oldServer ->
// Even though Rx should launch on the main thread it doesn't always :(
mainScope.launch {
if (oldServer != OFFLINE_DB_ID) {
// When the server changes, the playlist can retain the downloaded songs.
// Incomplete songs should be removed as the new server won't recognise them.
@ -194,6 +196,7 @@ class MediaPlayerManager(
switchToLocalPlayer()
}
}
}
rxBusSubscription += RxBus.activeServerChangedObservable.subscribe {
val jukebox = activeServerProvider.getActiveServer().jukeboxByDefault