-
Notifications
You must be signed in to change notification settings - Fork 75
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
Crash due to uninitialized state #933
Comments
Probably adding a default value parameter to Regarding volume specifically, isn't it kind of a bug that mpv even reports |
I think what's happening here is that it's not guaranteed that all observe-property-callbacks run before the render-timer-callback gets run for the first time. When that crash happened the cpu was already busy doing something else when mpv was started, so it could be that that's why initialization took unusually long and volume wasn't set yet. In that case we'd have to keep track which state variables have already been initialized and only render once all those callbacks have happened at least once. Then all the However I can't think of a good way to implement that. If the state table contained all fields from the start, we could create a second table containing all fields with |
I've just encountered the following crash
It happened in
VolumeSlider:render()
becausestate.volume
was stillnil
by the time the first render happened.Afaict that's not just a problem with volume, but can in theory happen with a lot of state variables in elements. We have no way to make sure everything necessary is non
nil
by the time we render.Considering how rarely this happens there is no reason to rush a solution, but we should discuss our options.
The obvious solution is putting
nil
checks all over the place, but maybe there is a better solution?We could also set some default value whenever it would be
nil
, but then we don't have the option of somehow representingnil
in the UI, if that even makes sense for some things.The text was updated successfully, but these errors were encountered: