[Android] Work with a copy of current playlist

Geoffrey Métais git at videolan.org
Mon Dec 17 11:44:52 CET 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Dec 17 11:43:53 2018 +0100| [96cf699b9919e3015bd2a663f8c8de181aaf6ad7] | committer: Geoffrey Métais

Work with a copy of current playlist

Should avoid ConcurrentModificationException

> https://code.videolan.org/videolan/vlc-android/commit/96cf699b9919e3015bd2a663f8c8de181aaf6ad7
---

 vlc-android/src/org/videolan/vlc/PlaybackService.kt       | 2 +-
 vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.kt b/vlc-android/src/org/videolan/vlc/PlaybackService.kt
index 20c67e9c4..d90b30f60 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.kt
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.kt
@@ -345,7 +345,7 @@ class PlaybackService : MediaBrowserServiceCompat(), CoroutineScope, LifecycleOw
 
     val medias: List<MediaWrapper>
         @MainThread
-        get() = playlistManager.getMediaList().toList()
+        get() = playlistManager.getMediaList()
 
     val mediaLocations: List<String>
         @MainThread
diff --git a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
index cdd6efc7d..2a30f5c70 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -675,7 +675,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
 
     fun getMediaListSize()= mediaList.size()
 
-    fun getMediaList(): MutableList<MediaWrapper> = mediaList.all
+    fun getMediaList(): List<MediaWrapper> = mediaList.all.toList()
 
     fun toggleABRepeat() {
         val time = player.getCurrentTime()



More information about the Android mailing list