From 27b4ccbeef4afbc1045fe48e9f0803e6a6ebfb0f Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Wed, 1 Jun 2016 09:29:32 +0200 Subject: [PATCH xserver v2] 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 or destroying the cursor. Signed-off-by: Olivier Fourdan Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96246 --- hw/xwayland/xwayland-cursor.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/xwayland/xwayland-cursor.c b/hw/xwayland/xwayland-cursor.c index 76729db..44fadf4 100644 --- a/hw/xwayland/xwayland-cursor.c +++ b/hw/xwayland/xwayland-cursor.c @@ -78,6 +78,10 @@ xwl_unrealize_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor) PixmapPtr pixmap; pixmap = dixGetPrivate(&cursor->devPrivates, &xwl_cursor_private_key); + if (!pixmap) + return TRUE; + + dixSetPrivate(&cursor->devPrivates, &xwl_cursor_private_key, NULL); return xwl_shm_destroy_pixmap(pixmap); } @@ -122,6 +126,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