Commit 4c25356d authored by Michel Dänzer's avatar Michel Dänzer Committed by Michel Dänzer
Browse files

xwayland: Check window pixmap in xwl_present_check_flip2

We can only flip if the window pixmap matches that of the toplevel
window. Doing so regardless could cause the toplevel window pixmap to
get destroyed while it was still referenced by the window, resulting in
use-after-free and likely a crash.

Closes: #1033

Reviewed-by: default avatarOlivier Fourdan <>
Reviewed-by: Roman Gilg's avatarRoman Gilg <>
parent 7ac303c7
......@@ -399,10 +399,18 @@ xwl_present_check_flip2(RRCrtcPtr crtc,
PresentFlipReason *reason)
struct xwl_window *xwl_window = xwl_window_from_window(present_window);
ScreenPtr screen = pixmap->drawable.pScreen;
if (!xwl_window)
return FALSE;
/* Can't flip if the window pixmap doesn't match the xwl_window parent
* window's, e.g. because a client redirected this window or one of its
* parents.
if (screen->GetWindowPixmap(xwl_window->window) != screen->GetWindowPixmap(present_window))
return FALSE;
* We currently only allow flips of windows, that have the same
* dimensions as their xwl_window parent window. For the case of
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