Skip to content

fix(player): guard against disposed tech in handleTechSourceset_ callback#9204

Open
okxint wants to merge 1 commit into
videojs:mainfrom
okxint:fix/handle-tech-sourceset-race-condition
Open

fix(player): guard against disposed tech in handleTechSourceset_ callback#9204
okxint wants to merge 1 commit into
videojs:mainfrom
okxint:fix/handle-tech-sourceset-race-condition

Conversation

@okxint

@okxint okxint commented Jun 16, 2026

Copy link
Copy Markdown

The loadstart async callback in handleTechSourceset_ could fire after the tech was disposed, causing it to write to this.tech_ or this.lastSource_.tech on a dead object. Added an early return guard for !this.tech_ and a null check on this.lastSource_ before writing.

Closes #9187

…back

The any(['sourceset', 'loadstart']) listener is registered asynchronously.
If the tech is disposed before the loadstart event fires, this.tech_ is
false and this.lastSource_ may no longer be valid, causing errors when
calling techGet_('currentSrc') or writing to lastSource_.tech.

Add early-return guards: skip the callback body if this.tech_ is falsy,
and only update lastSource_.tech when lastSource_ itself still exists.

Fixes videojs#9187
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.

Bug: Race condition in handleTechSourceset_() async callback

1 participant