Subject: [PATCH] gnu: gnome-settings-daemon: Fix crash when no screen saver available.

From: Noé Lopez <[email-masked]>
Date: Thu, 3 Apr 2025 09:34:59 +0200

Change-Id: Ic6da39489eb2e04f98ae112e6cd2cdb7340bd00e
---
 gnu/packages/gnome.scm                             |  4 +++-
 .../gnome-settings-daemon-screensaver-error.patch  | 14 ++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/gnome-settings-daemon-screensaver-error.patch

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 49c0c23c0c..ed75700683 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -6153,7 +6153,9 @@ (define-public gnome-settings-daemon
        (sha256
         (base32
          "0nka7zfl4hzzk4066kk5cc8pmk7v3izhi4wihsh5b3w85s35idqy"))
-       (patches (search-patches "gnome-settings-daemon-gc.patch"))))
+       (patches (search-patches "gnome-settings-daemon-gc.patch"
+                                ;; See https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/issues/792
+                                "gnome-settings-daemon-screensaver-error.patch"))))
     (build-system meson-build-system)
     (arguments
      (list
diff --git a/gnu/packages/patches/gnome-settings-daemon-screensaver-error.patch b/gnu/packages/patches/gnome-settings-daemon-screensaver-error.patch
new file mode 100644
index 0000000000..6707502261
--- /dev/null
+++ b/gnu/packages/patches/gnome-settings-daemon-screensaver-error.patch
@@ -0,0 +1,14 @@
+diff --git a/plugins/usb-protection/gsd-usb-protection-manager.c b/plugins/usb-protection/gsd-usb-protection-manager.c
+index 43644408..fef13645 100644
+--- a/plugins/usb-protection/gsd-usb-protection-manager.c
++++ b/plugins/usb-protection/gsd-usb-protection-manager.c
+@@ -1089,8 +1089,7 @@ usb_protection_proxy_ready (GObject      *source_object,
+ 
+         manager->screensaver_proxy = gnome_settings_bus_get_screen_saver_proxy ();
+         if (!manager->screensaver_proxy) {
+-                if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+-                        g_warning ("Failed to connect to screensaver service: %s", error->message);
++                g_warning ("Failed to connect to screensaver service");
+                 g_clear_object (&manager->usb_protection);
+                 return;
+         }

base-commit: eb30f5ecbea896e9cf93722bf97681d208f1a7be
-- 
2.49.0