[skip ci] various fixes

This commit is contained in:
Brahim Hadriche committed 2026-06-18 12:10:21 -04:00
1 parent 0c7bd4b3e0
commit 0f33f72cc1
7 files changed
+67 -2

No files matched your search

+3
View File
@@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Subtitles no longer stop displaying after shrinking the video to picture-in-picture and restoring it
- Fixed a video player crash that could occur near the end of a video
- Fixed a startup crash caused by corrupted saved-profiles data in the registry
- Fixed a crash that could occur when the video player failed to start playback
## [0.47.0] - 2026-06-18
@@ -24,14 +24,18 @@ function LoadProfilesFromRegistry()
' Step 1: Load user profiles from registry
userProfiles = RegistryUtils.Read(RegistryUtils.USER_PROFILES)
if userProfiles <> invalid
userProfiles = StringUtils.ParseJsonSafe(userProfiles)
if userProfiles = invalid
LogError("user_profiles registry value is corrupt (unparseable); resetting to empty")
end if
end if
if userProfiles = invalid
userProfiles = {
profiles: []
currentProfile: invalid
}
else
userProfiles = StringUtils.ParseJsonSafe(userProfiles)
end if
' Step 2: Migrate existing profiles to new format (if needed)
@@ -837,6 +837,12 @@ function OnPosition(event as object) as void
ApplyTransport()
EnforceTransportFreeze() ' OnPosition only fires while playing, so it catches a transport auto-resumed with no state-change edge.
' EnforceTransportFreeze can finish playback (FinishEof at the end of content under a transport), which
' synchronously closes the player and drops m.sponsorblock. A closed player must run no more of the tick.
if m.onCloseCalled = true
return
end if
' SponsorBlock auto-skip off the real position (the controller decides; we apply the seek / finish).
sb = m.sponsorblock.OnPosition(posMs)
if sb <> invalid
@@ -175,6 +175,7 @@ function TestSnapshot() as object
return {
transportMode: m.transport.transportMode
seekSettling: m.transport.seekSettling
onCloseCalled: m.onCloseCalled = true
control: m.top.control
autoplay: m.top.autoplayAfterSeek
bifVisible: m.bifDisplay.visible
@@ -188,3 +189,16 @@ function TestSnapshot() as object
barRemainingText: m.trickPlayBar.findNode("remainingLabel").text
}
end function
' TestWireQueueClose — make the stub videoQueue close the player when ClosePlayer writes closePlayer, mirroring
' the real VideoQueue.OnClosePlayer (which sets player.close = true). Opt-in: only the finish-during-tick
' re-entrancy spec needs the full synchronous teardown chain wired up.
function TestWireQueueClose() as void
m.videoQueue.observeFieldScoped("closePlayer", FuncName(OnTestQueueClose))
end function
function OnTestQueueClose() as void
if m.videoQueue.closePlayer
m.top.close = true
end if
end function
@@ -49,6 +49,7 @@
<function name="TestKey" />
<function name="TestSetState" />
<function name="TestSnapshot" />
<function name="TestWireQueueClose" />
<function name="TestSetControl" />
<function name="TestSetLive" />
<function name="TestFireLiveBadgeHold" />
@@ -417,6 +417,35 @@ namespace Tests
m.assertTrue(true, "no crash: the closed player ignored all post-close traffic")
end function
' Crash #1 (store: the dominant OnPosition crash, &hf3 ERR_RO3 "interface not a member"): a finish
' triggered from WITHIN a position tick re-enters teardown synchronously — EnforceTransportFreeze ->
' FinishEof -> OnPlaybackFinished -> ClosePlayer -> the queue sets player.close -> OnClose drops
' m.sponsorblock — then OnPosition continues to `m.sponsorblock.OnPosition()` and derefs the dropped
' controller. (`m.sponsorblock` is a field, so the invalid deref is &hf3, not &hec.) The OLD code crashes
' here; the onCloseCalled re-check after EnforceTransportFreeze bails. Kept LAST: OnClose detaches the node.
@it("a finish during a position tick must not deref the dropped sponsorblock (the OnPosition ERR_RO3 crash)")
function _()
m.top.callFunc("TestWireQueueClose") ' the stub queue now closes the player on closePlayer, as the real one does
m.top.duration = 100
m.top.position = 90
' scrub the cursor to the end (atEof) while the actual position is NOT yet at the end.
for i = 0 to 8
m.top.callFunc("TestKey", RemoteKeys.Right, true)
m.top.callFunc("TestKey", RemoteKeys.Right, false)
end for
m.assertEqual(m.Snap().transportMode, TransportController.Mode.Scrub)
' the device is PLAYING under the active transport (the INV-D1 anomaly EnforceTransportFreeze guards).
' Position is not yet at EOF, so this is a normal re-freeze — NOT a finish.
m.top.callFunc("TestSetState", VideoState.Playing)
m.assertFalse(m.Snap().onCloseCalled, "not finished yet — the position is not at EOF")
' NOW a position tick lands at the end -> OnPosition -> EnforceTransportFreeze -> FinishEof ->
' OnPlaybackFinished -> ClosePlayer -> (re-entrant) OnClose drops m.sponsorblock -> OnPosition then
' derefs the dropped controller. The old code faults here (&hf3); the fix bails first.
m.top.position = 99
' reaching here means OnPosition survived the re-entrant teardown.
m.assertTrue(m.Snap().onCloseCalled, "the finish closed the player from within the position tick")
end function
end class
end namespace
@@ -48,6 +48,10 @@ function OnPlay() as void
end if
player = CreateVideoPlayer()
if player = invalid
m.top.nowPlaying = invalid
return
end if
player@.PlayWithContent(videoNode)
m.top.player = player
m.top.nowPlaying = videoNode
@@ -364,6 +368,10 @@ function CreateVideoPlayer() as object
container = m.top.videoContainer
videoPlayer = container.createChild(playerComponent)
if videoPlayer = invalid
LogError("createChild returned invalid for", playerComponent, "- cannot start playback")
return invalid
end if
videoPlayer.id = "VideoPlayer"
videoPlayer.previousPlayer = m.previousPlayer
' without this, the queue pins every last-closed player for the app's lifetime.