mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-15 11:26:32 +02:00
This fixes a crash when a track is enabled and then disabled while a seek is in progress. The logic in SeekingStateHandler is reworked to keep track of the tracks that are currently being seeked, and when a track is disabled, it is no longer counted against the seek completion. Any seek completion callback that was instated is cleared by calling seek with a null callback. It may be worth making a separate function on the data providers to clear the current seek instead, to avoid the extra work of seeking, but this scenario is a very rare one unless someone intentionally triggers it, and the cost is minimal unless the toggles are spammed. A crash test is included, which both tests for the crash, and would also time out if the failing VERIFY in on_track_enabled() was avoided with the previous seeking implementation, due to the originally-enabled video track's seek callback being clobbered by on_track_enabled()'s seek.