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



commit e741adb82e18fff557cb95185756f56ca7afcf3d
Author: Sebastian Keller <sebastian-keller gmx de>
Date:   Thu Aug 2 00:58:56 2018 +0200

    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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]