BlueHuskyStudios / BlueHuskyStudios/DeadassSimpleMediaPlayer
`setupNowPlaying()` defers its write by a run-loop turn, creating an ordering hazard
- Dominant language
- Swift
- Stars
- 0
- Forks
- 3
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 9
Description
The dictionary is built synchronously but assigned inside `Task { @MainActor in ... }`. Meanwhile `updateNowPlayingPlaybackPosition()` reads `MPNowPlayingInfoCenter.default().nowPlayingInfo` synchronously.
If a position update lands between the build and the deferred assignment, it reads the *old* dictionary, merges new position into it, writes — and is then clobbered by the pending full write. `prepareNewMedia` calls `setupNowPlaying()` and then spawns two more `Task`s that call it again, so the interleaving is not hypothetical.
Contributor guide
Research direction
Start by locating setupNowPlaying() and updateNowPlayingPlaybackPosition(), then trace how prepareNewMedia() invokes setupNowPlaying() and the two additional Tasks. Reproduce or reason through the ordering between the full dictionary assignment and position update; done means a position update cannot be clobbered by a pending full write.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100