-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
FilePlayer potentially leaks event listeners #616
Comments
This is true, but only for the callback props that we don't set in as the functions we set here won't change. Perhaps the solution is to store an array of listeners that we add, then in |
Having instance methods that just proxy calls to correspondent props seems to be more flexible. |
https://github.com/CookPete/react-player/blob/master/src/players/FilePlayer.js#L84
When
ReactPlayer
removes listeners from the<video>
element, it callsremoveEventListener
passing callbacks from current props. But nothing guarantees that they are same functions passed toaddEventListener
on player initialization. Actually they most likely are another function objects, especially ifReactPlayer
was rendered inside a functional component. In that case, calls toremoveEventListener
are actually no-ops while mistakenly looking like memory-saving destructors.example:
The text was updated successfully, but these errors were encountered: