From e741adb82e18fff557cb95185756f56ca7afcf3d Mon Sep 17 00:00:00 2001 From: Sebastian Keller Date: Thu, 2 Aug 2018 00:58:56 +0200 Subject: [PATCH] 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 --- src/x11/meta-x11-display.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c index b2510b530..83f7dfbae 100644 --- a/src/x11/meta-x11-display.c +++ b/src/x11/meta-x11-display.c @@ -1483,7 +1483,9 @@ meta_x11_display_reload_cursor (MetaX11Display *x11_display) XDefineCursor (x11_display->xdisplay, x11_display->xroot, xcursor); XFlush (x11_display->xdisplay); - XFreeCursor (x11_display->xdisplay, xcursor); + + if (xcursor) + XFreeCursor (x11_display->xdisplay, xcursor); } static void