Commit 22c0808a authored by Michel Dänzer's avatar Michel Dänzer Committed by Olivier Fourdan

xwayland: Free all remaining events in xwl_present_cleanup

At the end of xwl_present_cleanup, these events aren't reachable
anymore, so if we don't free them first, they're leaked.

(cherry picked from commit 64565ea344fef0171497952ef75f019cb420fe3b)

v2:
* Simpler backport, no need to keep a reference to the pixmap on the
  1.20 branch.
parent 37779d7f
Pipeline #179199 passed with stages
in 3 minutes and 39 seconds
......@@ -114,6 +114,12 @@ xwl_present_reset_timer(struct xwl_present_window *xwl_present_window)
static void
xwl_present_free_event(struct xwl_present_event *event)
{
if (!event)
return;
if (event->buffer)
wl_buffer_set_user_data(event->buffer, NULL);
xorg_list_del(&event->list);
free(event);
}
......@@ -138,21 +144,10 @@ xwl_present_cleanup(WindowPtr window)
xorg_list_for_each_entry_safe(event, tmp, &xwl_present_window->event_list, list)
xwl_present_free_event(event);
/* Clear remaining buffer releases and inform Present about free ressources */
event = xwl_present_window->sync_flip;
xwl_present_window->sync_flip = NULL;
if (event) {
if (event->buffer_released) {
xwl_present_free_event(event);
} else {
event->pending = FALSE;
event->abort = TRUE;
}
}
xorg_list_for_each_entry_safe(event, tmp, &xwl_present_window->release_queue, list) {
xorg_list_del(&event->list);
event->abort = TRUE;
}
xwl_present_free_event(xwl_present_window->sync_flip);
xorg_list_for_each_entry_safe(event, tmp, &xwl_present_window->release_queue, list)
xwl_present_free_event(event);
/* Clear timer */
xwl_present_free_timer(xwl_present_window);
......@@ -353,6 +348,7 @@ xwl_present_queue_vblank(WindowPtr present_window,
return BadAlloc;
event->event_id = event_id;
event->buffer = NULL;
event->xwl_present_window = xwl_present_window;
event->target_msc = msc;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment