wayland: Don't crash on cursor size 0
authorMatthias Clasen <mclasen@redhat.com>
Sun, 26 Mar 2023 00:25:51 +0000 (20:25 -0400)
committerGaël Bonithon <gael@xfce.org>
Tue, 28 Mar 2023 16:38:34 +0000 (18:38 +0200)
The cursor-theme-size setting is documented as
'0 means the default size'. Make it so by using
size 24 if we see a 0. Its better than crashing.

Fixes: #5700
(cherry picked from commit 7adbbe6f35347b19319d9e4ce8c92fb0e861524b)

gdk/wayland/gdkdisplay-wayland.c

index 55c0388ec6b5fba770ee4d37bd4b48626005ba1b..42a6fb85096689649a8b665a1d3c1c4fe2e74e7e 100644 (file)
@@ -1128,6 +1128,9 @@ gdk_wayland_display_set_cursor_theme (GdkDisplay  *display,
   g_assert (display_wayland);
   g_assert (display_wayland->shm);
 
+  if (size == 0)
+    size = 24;
+
   if (g_strcmp0 (name, display_wayland->cursor_theme_name) == 0 &&
       display_wayland->cursor_theme_size == size)
     return;