Commit b2594859 authored by Michel Dänzer's avatar Michel Dänzer Committed by Olivier Fourdan
Browse files

xwayland: Delete all frame_callback_list nodes in xwl_unrealize_window

We were only calling xwl_present_unrealize_window for the toplevel
window, but the list can contain entries from child windows as well,
in which case we were leaving dangling pointers to freed memory.

Closes: #1000
Fixes: c5067fea

 "xwayland: Use single frame callback for Present
                     flips and normal updates"
Reviewed-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
Tested-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 5e915873)
parent a0335716
Pipeline #121122 passed with stages
in 7 minutes and 44 seconds
......@@ -524,14 +524,8 @@ xwl_present_flips_stop(WindowPtr window)
}
void
xwl_present_unrealize_window(WindowPtr window)
xwl_present_unrealize_window(struct xwl_present_window *xwl_present_window)
{
struct xwl_present_window *xwl_present_window = xwl_present_window_priv(window);
if (!xwl_present_window ||
xorg_list_is_empty(&xwl_present_window->frame_callback_list))
return;
/* The pending frame callback may never be called, so drop it and shorten
* the frame timer interval.
*/
......
......@@ -700,8 +700,15 @@ xwl_unrealize_window(WindowPtr window)
wl_callback_destroy(xwl_window->frame_callback);
#ifdef GLAMOR_HAS_GBM
if (xwl_screen->present)
xwl_present_unrealize_window(window);
if (xwl_screen->present) {
struct xwl_present_window *xwl_present_window, *tmp;
xorg_list_for_each_entry_safe(xwl_present_window, tmp,
&xwl_window->frame_callback_list,
frame_callback_list) {
xwl_present_unrealize_window(xwl_present_window);
}
}
#endif
free(xwl_window);
......
......@@ -456,7 +456,7 @@ void xwl_glamor_egl_make_current(struct xwl_screen *xwl_screen);
void xwl_present_frame_callback(struct xwl_present_window *xwl_present_window);
Bool xwl_present_init(ScreenPtr screen);
void xwl_present_cleanup(WindowPtr window);
void xwl_present_unrealize_window(WindowPtr window);
void xwl_present_unrealize_window(struct xwl_present_window *xwl_present_window);
#endif /* GLAMOR_HAS_GBM */
#ifdef XV
......
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