[mutter/wip/rstrode/rhel-8.0.0: 28/117] backends/x11: Only free cursor if it was created successfully



commit 2d36f92c55f5297caa25814933499c8d62ffa264
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
    
    (cherry picked from commit 1bfa20929b36d06cc23667d1122175149615b56d)

 src/core/screen.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/core/screen.c b/src/core/screen.c
index 048104150..85a55b1e3 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -1397,7 +1397,9 @@ meta_screen_update_cursor (MetaScreen *screen)
 
   XDefineCursor (display->xdisplay, screen->xroot, xcursor);
   XFlush (display->xdisplay);
-  XFreeCursor (display->xdisplay, xcursor);
+
+  if (xcursor)
+    XFreeCursor (display->xdisplay, xcursor);
 }
 
 void


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