wayland: correct braindead comment (no-op)

I was confused in d3a28f12c9 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).
This commit is contained in:
Dudemanguy 2022-10-31 20:25:40 -05:00
parent d3a28f12c9
commit 5fa3bca863
1 changed files with 4 additions and 5 deletions

View File

@ -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;