Skip to content

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
kdroidFilter:masterfrom
muthuraj57:fix-error-state
Open

muthuraj57 wants to merge 1 commit into
kdroidFilter:masterfrom
muthuraj57:fix-error-state

Conversation

@muthuraj57

@muthuraj57 muthuraj57 commented Oct 24, 2026 •

Copy link
Copy Markdown

Summary

Part of #253.

  • Windows: _error was a plain field (not snapshot state) and openUriInternal never 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 now mutableStateOf and cleared at the start of each open.
  • Linux: clearError() did runBlocking { 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 sets error = null.

Test plan

  • Windows 11: unreachable URL, then a valid file on the same state: the error shows, then clears and the file plays (v0.11.4 kept loading on the bad URL)
  • Ubuntu 24.04: same sequence; error cleared, file plays
  • :mediaplayer:compileKotlinJvm, ktlintCheck adds no findings

…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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants