Commit d18dcecb authored by Olivier Fourdan's avatar Olivier Fourdan
Browse files

xwayland: Clean up pending eglstream on pixmap destroy



EGLStream implementation in Xwayland keeps a list of pending streams for
a window.

If the windows's pixmap is destroyed while there is a pending stream,
the pending stream will point to freed memory once the callback is
triggered.

Make sure to cancel the pending stream if there's one when the pixmap is
destroyed.

v2:
 * Use xorg_list_for_each_entry() instead of the safe variant (Michel
   Dänzer <mdaenzer@redhat.com>)
Signed-off-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
Tested-by: Karol Szuster's avatarKarol Szuster <karolsz9898@gmail.com>
Acked-by: Michel Dänzer's avatarMichel Dänzer <mdaenzer@redhat.com>
Closes #1096
parent 662b2bcb
Pipeline #233729 passed with stages
in 5 minutes and 32 seconds
......@@ -298,12 +298,32 @@ xwl_eglstream_unref_pixmap_stream(struct xwl_pixmap *xwl_pixmap)
free(xwl_pixmap);
}
static void
xwl_glamor_eglstream_del_pending_stream_cb(struct xwl_pixmap *xwl_pixmap)
{
struct xwl_eglstream_private *xwl_eglstream =
xwl_eglstream_get(xwl_pixmap->xwl_screen);
struct xwl_eglstream_pending_stream *pending;
xorg_list_for_each_entry(pending,
&xwl_eglstream->pending_streams, link) {
if (pending->xwl_pixmap == xwl_pixmap) {
wl_callback_destroy(pending->cb);
xwl_eglstream_window_set_pending(pending->window, NULL);
xorg_list_del(&pending->link);
free(pending);
break;
}
}
}
static Bool
xwl_glamor_eglstream_destroy_pixmap(PixmapPtr pixmap)
{
struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap);
if (xwl_pixmap && pixmap->refcnt == 1) {
xwl_glamor_eglstream_del_pending_stream_cb(xwl_pixmap);
xwl_pixmap_del_buffer_release_cb(pixmap);
xwl_eglstream_unref_pixmap_stream(xwl_pixmap);
}
......
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