[PATCH] xwayland: Do set root clip with rootless

Olivier Fourdan ofourdan at redhat.com
Fri Nov 20 09:41:24 PST 2015


Otherwise the server may try to draw onto the root window when closing
down, while when rootless the root window which has no storage, thus
causing memory corruption.

Thanks to Adam Jackson <ajax at redhat.com> for helping tracking this down!

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93045
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
---
 hw/xwayland/xwayland-glamor.c | 4 +++-
 hw/xwayland/xwayland-output.c | 4 ----
 hw/xwayland/xwayland-shm.c    | 4 +++-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c
index ebaf05a..16d1ab9 100644
--- a/hw/xwayland/xwayland-glamor.c
+++ b/hw/xwayland/xwayland-glamor.c
@@ -233,9 +233,11 @@ xwl_glamor_create_screen_resources(ScreenPtr screen)
     if (!ret)
         return ret;
 
-    if (xwl_screen->rootless)
+    if (xwl_screen->rootless) {
         screen->devPrivate =
             fbCreatePixmap(screen, 0, 0, screen->rootDepth, 0);
+            SetRootClip(screen, FALSE);
+    }
     else {
         screen->devPrivate =
             xwl_glamor_create_pixmap(screen, screen->width, screen->height,
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index f97f100..9101382 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -164,9 +164,6 @@ update_screen_size(struct xwl_output *xwl_output, int width, int height)
     struct xwl_screen *xwl_screen = xwl_output->xwl_screen;
     double mmpd;
 
-    if (xwl_screen->screen->root)
-        SetRootClip(xwl_screen->screen, FALSE);
-
     xwl_screen->width = width;
     xwl_screen->height = height;
     xwl_screen->screen->width = width;
@@ -184,7 +181,6 @@ update_screen_size(struct xwl_output *xwl_output, int width, int height)
     if (xwl_screen->screen->root) {
         xwl_screen->screen->root->drawable.width = width;
         xwl_screen->screen->root->drawable.height = height;
-        SetRootClip(xwl_screen->screen, TRUE);
         RRScreenSizeNotify(xwl_screen->screen);
     }
 
diff --git a/hw/xwayland/xwayland-shm.c b/hw/xwayland/xwayland-shm.c
index 1022c0d..3c42456 100644
--- a/hw/xwayland/xwayland-shm.c
+++ b/hw/xwayland/xwayland-shm.c
@@ -279,9 +279,11 @@ xwl_shm_create_screen_resources(ScreenPtr screen)
     if (!ret)
         return ret;
 
-    if (xwl_screen->rootless)
+    if (xwl_screen->rootless) {
         screen->devPrivate =
             fbCreatePixmap(screen, 0, 0, screen->rootDepth, 0);
+            SetRootClip(screen, FALSE);
+    }
     else
         screen->devPrivate =
             xwl_shm_create_pixmap(screen, screen->width, screen->height,
-- 
2.5.0



More information about the xorg-devel mailing list