mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-05-06 08:08:06 +02:00
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 <ofourdan@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96246
(cherry picked from commit edd24aa50b)
This commit is contained in:
parent
f05a585910
commit
5c549168a2
1 changed files with 15 additions and 0 deletions
|
|
@ -76,8 +76,20 @@ static Bool
|
|||
xwl_unrealize_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor)
|
||||
{
|
||||
PixmapPtr pixmap;
|
||||
struct xwl_seat *xwl_seat;
|
||||
|
||||
pixmap = dixGetPrivate(&cursor->devPrivates, &xwl_cursor_private_key);
|
||||
if (!pixmap)
|
||||
return TRUE;
|
||||
|
||||
dixSetPrivate(&cursor->devPrivates, &xwl_cursor_private_key, NULL);
|
||||
|
||||
/* When called from FreeCursor(), device is always NULL */
|
||||
if (device) {
|
||||
xwl_seat = device->public.devicePrivate;
|
||||
if (xwl_seat && cursor == xwl_seat->x_cursor)
|
||||
xwl_seat->x_cursor = NULL;
|
||||
}
|
||||
|
||||
return xwl_shm_destroy_pixmap(pixmap);
|
||||
}
|
||||
|
|
@ -122,6 +134,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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue