summaryrefslogtreecommitdiffstats
path: root/libmpv
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-09-20 16:31:53 +0200
committerwm4 <wm4@nowhere>2019-09-20 16:31:53 +0200
commitf00af71d12a7d155d4d80f0879931c3f54c7ab9b (patch)
tree6d15f1d352972d77cfbb39bb29d5b7f3ecec4aa3 /libmpv
parent3ae728532dbd8f4baa77a1e8ad74066719613e92 (diff)
downloadmpv-f00af71d12a7d155d4d80f0879931c3f54c7ab9b.tar.bz2
mpv-f00af71d12a7d155d4d80f0879931c3f54c7ab9b.tar.xz
vo_libmpv: fix some more uninit issues
This is mostly for the case when mpv_render_context_free() is called while video is going on. This is supposed to gracefully stop video and deinitialize everything properly. (I feel like it would put too much on the API user to require that video is stopped before calling this function. Whether video is running or not is a fairly highlevel thing, and the API user could not do it in a race-free way.) One problem was that unit() accessed ctx after ctx->in_use was set to false. The update(ctx) call was basically a racy use-after-free. It needed that call to wake up the mpv_render_context_free() loop that waited for VO uninit. Fix this by triggering the wakeup inside the lock, and then doing "barrier" locking in mpv_render_context_free(). Another problem was that the wait loop didn't really wait properly. IT seems the had_kill_update field was a botched attempt to do that. It's indeed quite hairy to do that with update(). Instead make use of the dispatch queue (infinite timeout, using mp_dispatch_interrupt()), which handles the problem of having to wait both for dispatch queue updates and VO uninit at the same time.
Diffstat (limited to 'libmpv')
0 files changed, 0 insertions, 0 deletions