From 63e0773419a2f35ec9f8703c9fb5a11dddb33cf0 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Wed, 1 Jun 2016 09:29:32 +0200 Subject: [PATCH RFC xserver] wayland: clear resource for pixmap on unrealize On cursor unrealize, the associated pixmap is destroyed, make sure we clear the pointer from the private resource and check for the value being non-null when setting the cursor. Signed-off-by: Olivier Fourdan Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96246 --- hw/xwayland/xwayland-cursor.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/xwayland/xwayland-cursor.c b/hw/xwayland/xwayland-cursor.c index 76729db..6e87f0e 100644 --- a/hw/xwayland/xwayland-cursor.c +++ b/hw/xwayland/xwayland-cursor.c @@ -78,6 +78,7 @@ xwl_unrealize_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor) PixmapPtr pixmap; pixmap = dixGetPrivate(&cursor->devPrivates, &xwl_cursor_private_key); + dixSetPrivate(&cursor->devPrivates, &xwl_cursor_private_key, NULL); return xwl_shm_destroy_pixmap(pixmap); } @@ -122,6 +123,9 @@ xwl_seat_set_cursor(struct xwl_seat *xwl_seat) cursor = xwl_seat->x_cursor; pixmap = dixGetPrivate(&cursor->devPrivates, &xwl_cursor_private_key); + if (!pixmap) + return; + stride = cursor->bits->width * 4; if (cursor->bits->argb) memcpy(pixmap->devPrivate.ptr, -- 2.7.4