From 0394a27074b8067bf22b586ab52f22d79f088f10 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Mon, 1 May 2023 21:41:26 +0200 Subject: [PATCH] Wayland: wl_cursor_theme_load() may return NULL --- src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx | 5 ++++- src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx index d7f6a32be..ed9ae1313 100644 --- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx @@ -1227,7 +1227,10 @@ void Fl_Wayland_Screen_Driver::close_display() { } wl_subcompositor_destroy(wl_subcompositor); wl_subcompositor = NULL; wl_surface_destroy(seat->cursor_surface); seat->cursor_surface = NULL; - wl_cursor_theme_destroy(seat->cursor_theme); seat->cursor_theme = NULL; + if (seat->cursor_theme) { + wl_cursor_theme_destroy(seat->cursor_theme); + seat->cursor_theme = NULL; + } wl_compositor_destroy(wl_compositor); wl_compositor = NULL; wl_shm_destroy(wl_shm); wl_shm = NULL; if (seat->wl_keyboard) { diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx index 080f7f149..fc3d22801 100644 --- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx @@ -1330,7 +1330,7 @@ void Fl_Wayland_Window_Driver::resize_after_screen_change(void *data) { int Fl_Wayland_Window_Driver::set_cursor(Fl_Cursor c) { Fl_Wayland_Screen_Driver *scr_driver = (Fl_Wayland_Screen_Driver*)Fl::screen_driver(); struct wld_window *xid = (struct wld_window *)Fl_Window_Driver::xid(pWindow); - + if (!scr_driver->seat->cursor_theme) return 1; // Cursor names are the files of directory /usr/share/icons/XXXX/cursors/ // where XXXX is the name of the current 'cursor theme'. switch (c) {