osc: fix rare stack overflow when changing visibility mode

Under some conditions, hide_osc() was calling render(), which then called
hide_osc() again, and so forth, until the stack overflows.

Tracking the exact conditions where this happens (and then managing them
to prevent it) is an excercise in futility.

Remove the osc directly - instead of going through the entire rendering
procedure just to end up rendering nothing.

Fixes #4900 .
This commit is contained in:
Avi Halachmi (:avih) 2017-09-20 05:53:10 +03:00 committed by avih
parent 2dd2acac89
commit 365b1d4f3d
1 changed files with 6 additions and 1 deletions

View File

@ -1894,7 +1894,7 @@ function hide_osc()
-- no-op and won't render again to remove the osc, so do that manually.
state.osc_visible = false
timer_stop()
render() -- state.osc_visible == false -> remove the osc from screen
render_wipe()
elseif (user_opts.fadeduration > 0) then
if not(state.osc_visible == false) then
state.anitype = "out"
@ -1973,6 +1973,11 @@ function request_init()
state.initREQ = true
end
function render_wipe()
msg.debug("render_wipe()")
mp.set_osd_ass(0, 0, "{}")
end
function render()
msg.debug("rendering")
local current_screen_sizeX, current_screen_sizeY, aspect = mp.get_osd_size()