hw/xfree86: Avoid cursor use after free

During a VT-Switch a raw pointer to the shared cursor object
is saved which is then freed (in case of low refcount) by a call to
xf86CursorSetCursor with argument pCurs = NullCursor.
This leads to a dangling pointer which can follow in a use after free.

This fix ensures that there is a shared handle saved for the VT-Switch cycle.

Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
4 jobs for cursor-fix-use-after-free in 3 minutes and 43 seconds (queued for 2 seconds)
Status Job ID Name Coverage
  Docker Image
passed #3266050
debian-testing

00:00:21

 
  Build And Test
passed #3266051
autotools

00:03:22

passed #3266052
meson

00:01:07

passed #3266053
meson-noglamor

00:00:47