Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: avoid uiTextDisplayer.destroy crashing if called more than once #6022

Merged
merged 1 commit into from Jan 8, 2024

Conversation

antondc
Copy link
Contributor

@antondc antondc commented Dec 21, 2023

Currently an instance of uiTextDisplayer is not idempotent, crashing if uiTextDisplayer.destroy() is called more than once:

const uiTextDisplayer = new shaka.text.UITextDisplayer(
  videoElement,
  subtitlesElement
);

uiTextDisplayer.destroy();
uiTextDisplayer.destroy();

This is due to videoContainer.removeChild being called with null parameter on the second interation, as textContainer was already deleted on the first one.
Source:

this.videoContainer_.removeChild(this.textContainer_);

An early return will prevent this crash, maintaining consistency with other methods.

Already created an issue for this bug at: #6023

@avelad avelad linked an issue Dec 23, 2023 that may be closed by this pull request
@avelad avelad added type: bug Something isn't working correctly priority: P2 Smaller impact or easy workaround labels Dec 23, 2023
@avelad avelad added this to the v5.0 milestone Dec 23, 2023
@avelad avelad merged commit 42c235d into shaka-project:main Jan 8, 2024
18 of 20 checks passed
joeyparrish pushed a commit that referenced this pull request Feb 17, 2024
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Mar 8, 2024
@shaka-project shaka-project locked as resolved and limited conversation to collaborators Mar 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority: P2 Smaller impact or easy workaround status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix: UITextDisplayer should not crash if called more than once
3 participants