backends/x11: Only free cursor if it was created successfully

XcursorLibraryLoadCursor can return 'None' if the current cursor theme
is missing the requested icon. If XFreeCursor is then called on this
cursor, it generates a BadCursor error causing gnome-shell to crash.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/254
This commit is contained in:
Sebastian Keller 2018-08-02 00:58:56 +02:00
parent deb541ef5a
commit e741adb82e

View File

@ -1483,7 +1483,9 @@ meta_x11_display_reload_cursor (MetaX11Display *x11_display)
XDefineCursor (x11_display->xdisplay, x11_display->xroot, xcursor); XDefineCursor (x11_display->xdisplay, x11_display->xroot, xcursor);
XFlush (x11_display->xdisplay); XFlush (x11_display->xdisplay);
XFreeCursor (x11_display->xdisplay, xcursor);
if (xcursor)
XFreeCursor (x11_display->xdisplay, xcursor);
} }
static void static void