diff options
author | Dudemanguy <random342@airmail.cc> | 2022-10-31 20:25:40 -0500 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2022-10-31 20:45:56 -0500 |
commit | 5fa3bca86359d59bfd72554f84ee67814a8f9111 (patch) | |
tree | 1e62750961bdc659102423f002a0b6c112722b47 | |
parent | d3a28f12c9ced29982fc831722075bd0c73fb821 (diff) | |
download | mpv-5fa3bca86359d59bfd72554f84ee67814a8f9111.tar.bz2 mpv-5fa3bca86359d59bfd72554f84ee67814a8f9111.tar.xz |
wayland: correct braindead comment (no-op)
I was confused in d3a28f12c9ced29982fc831722075bd0c73fb821 why it
actually even worked, but after not being stupid, it's quite obviously
just a dangling pointer. The reason it only happens with
wp_presentation_feedback is because the object and listener actually
created in frame_callback not the presentation events itself (for vsync
timing reasons). So it is possible to free the object, but not
immediately recreate it again before quitting (unlike with the frame
callback). The actual comment is moved into feedback_presented (which is
first) but as of this commit it doesn't have the NULL setting logic
(that's the next one).
-rw-r--r-- | video/out/wayland_common.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index f2f3ef02f9..308e035ccd 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -1016,6 +1016,9 @@ static void feedback_presented(void *data, struct wp_presentation_feedback *fbac { struct vo_wayland_state *wl = data; + // NULL is needed to prevent a dangling pointer since presentation_feedback + // is created in the frame_callback and not in any of the actual presentation + // events. if (fback) wp_presentation_feedback_destroy(fback); @@ -1043,11 +1046,7 @@ static void feedback_discarded(void *data, struct wp_presentation_feedback *fbac { struct vo_wayland_state *wl = data; - // Really weird hack needed here. wlroots and weston send the discarded event - // only once (not every frame) if the window is hidden. If mpv quits in this - // state, fback will get destroyed but wl->feedback (in theory, this is supposed - // to be same as fback) will not be NULL and thus will be mistakenly tried to be - // free'd again. Hack this by just setting it to NULL explicitly. + // Same logic in feedback_presented applies here. if (fback) { wp_presentation_feedback_destroy(fback); wl->feedback = NULL; |