From 19f6f6454c8eb279451127683e897914ca2b5e43 Mon Sep 17 00:00:00 2001 From: hujianwei Date: Sun, 23 Oct 2022 11:56:35 +0000 Subject: [PATCH] Fix problems found with Firefox Nightly * subsurface.c (Teardown): Correctly free subsurface actions. * xdg_surface.c (NoteFrame): Fix conditions to avoid frame callback spam. --- subsurface.c | 9 ++++++--- xdg_surface.c | 6 +++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/subsurface.c b/subsurface.c index c759004..8873bbd 100644 --- a/subsurface.c +++ b/subsurface.c @@ -798,7 +798,7 @@ Teardown (Surface *surface, Role *role) { Subsurface *subsurface; SurfaceActionClientData *client; - SurfaceAction *action; + SurfaceAction *action, *last; Subcompositor *subcompositor; subsurface = SubsurfaceFromRole (role); @@ -831,8 +831,11 @@ Teardown (Surface *surface, Role *role) while (action != &client->actions) { - if (action->subsurface == subsurface) - DestroySurfaceAction (action); + last = action; + action = action->next; + + if (last->subsurface == subsurface) + DestroySurfaceAction (last); } } diff --git a/xdg_surface.c b/xdg_surface.c index 6084501..0583b94 100644 --- a/xdg_surface.c +++ b/xdg_surface.c @@ -1295,9 +1295,6 @@ NoteFrame (FrameMode mode, uint64_t id, void *data) /* End the frame. */ XLFrameClockEndFrame (role->clock); - /* Clear the frame completed flag. */ - role->state &= ~StateFrameStarted; - /* No frame was started clock-side for this frame. That means programs waiting for frame callbacks will not get any, so the frame callbacks must be run by hand. */ @@ -1310,6 +1307,9 @@ NoteFrame (FrameMode mode, uint64_t id, void *data) RunFrameCallbacksConditionally (role); } + /* Clear the frame completed flag. */ + role->state &= ~StateFrameStarted; + if (mode == ModePresented && renderer_flags & SupportsDirectPresent) {