[Android] Browser: clear eventlistener in background
Geoffrey Métais
git at videolan.org
Wed Feb 10 07:30:36 UTC 2021
vlc-android | branch: master | Geoffrey Métais <gmetais at deezer.com> | Tue Feb 9 21:38:10 2021 +0100| [2f58ae8dde004feb27c7760f271f80aab6e6ecfb] | committer: Nicolas Pomepuy
Browser: clear eventlistener in background
mediabrowser.changeEventListener calls reset() which can lead to block
the current thread
> https://code.videolan.org/videolan/vlc-android/commit/2f58ae8dde004feb27c7760f271f80aab6e6ecfb
---
.../vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt b/application/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
index f5a275899..8e6111ded 100644
--- a/application/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
+++ b/application/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
@@ -205,7 +205,9 @@ abstract class BrowserProvider(val context: Context, val dataset: LiveDataset<Me
override fun onMediaRemoved(index: Int, media: IMedia) {}
}
requestBrowsing(url, listener, interact)
- awaitClose { if (url != null) mediabrowser?.changeEventListener(null) }
+ awaitClose { if (url != null) AppScope.launch(coroutineContextProvider.IO) {
+ mediabrowser?.changeEventListener(null) }
+ }
}.buffer(Channel.UNLIMITED)
open fun addMedia(media: MediaLibraryItem) {
More information about the Android
mailing list