Repository navigation
fix(jvm): clear a previous error when opening new media; Linux clearError no longer blocks on Main - #257
Open
muthuraj57 wants to merge 1 commit into
Open
fix(jvm): clear a previous error when opening new media; Linux clearError no longer blocks on Main#257muthuraj57 wants to merge 1 commit into
muthuraj57 wants to merge 1 commit into
Conversation
…rror no longer blocks on Main Windows kept _error in a plain field and never cleared it on open, so one failed source left error set for every later successful one, and Compose did not observe it (kdroidFilter#253). It is now snapshot state, cleared at the start of each open. Linux clearError() did runBlocking(Dispatchers.Main), which deadlocks when called from the UI thread; snapshot state can be written directly.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part of #253.
_errorwas a plain field (not snapshot state) andopenUriInternalnever cleared it, so after one failed source every later successful source still reported the old error, and Compose never recomposed on error changes. It is nowmutableStateOfand cleared at the start of each open.clearError()didrunBlocking { withContext(Dispatchers.Main) { … } }, which deadlocks when called from the UI thread (the natural place to call it). Snapshot state can be written from any thread, so it now just setserror = null.Test plan
:mediaplayer:compileKotlinJvm,ktlintCheckadds no findings