Fix problems found with Firefox Nightly

* subsurface.c (Teardown): Correctly free subsurface actions.
* xdg_surface.c (NoteFrame): Fix conditions to avoid frame
callback spam.
This commit is contained in:
hujianwei 2022-10-23 11:56:35 +00:00
parent 0612e0df6e
commit 19f6f6454c
2 changed files with 9 additions and 6 deletions

View file

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

View file

@ -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)
{