From 0f754df9f40b32753e03749168aaeb3d83121882 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Wed, 2 Oct 2024 12:00:21 +0200 Subject: [PATCH 1/4] manager: Don't error-out on logind communication failure Closes #400. --- src/gpm-manager.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gpm-manager.c b/src/gpm-manager.c index 30cf92a3..40050629 100644 --- a/src/gpm-manager.c +++ b/src/gpm-manager.c @@ -1751,7 +1751,7 @@ gpm_manager_systemd_inhibit (GDBusProxy *proxy) { &error ); //append all our arguments if (proxy == NULL) { - g_error ("Error connecting to dbus - %s", error->message); + g_warning ("Error connecting to dbus - %s", error->message); g_error_free (error); return -1; } @@ -1770,7 +1770,7 @@ gpm_manager_systemd_inhibit (GDBusProxy *proxy) { &error ); if (error != NULL) { - g_error ("Error in dbus - %s", error->message); + g_warning ("Error in dbus - %s", error->message); g_error_free (error); return -EIO; } From 1a3b70bbe58355684cf896449fd0405fc05fdc2b Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Wed, 2 Oct 2024 12:03:01 +0200 Subject: [PATCH 2/4] button: Don't leak DBus proxy on successful logind lid handling --- src/gpm-button.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gpm-button.c b/src/gpm-button.c index 5bfe19d5..c440c5b1 100644 --- a/src/gpm-button.c +++ b/src/gpm-button.c @@ -284,6 +284,7 @@ gpm_button_is_lid_closed (GpmButton *button) NULL, &error ); + g_object_unref(proxy); if (error == NULL && res != NULL) { g_variant_get(res, "(v)", &inner ); lid = g_variant_get_boolean(inner); @@ -294,7 +295,6 @@ gpm_button_is_lid_closed (GpmButton *button) g_error ("Error in dbus - %s", error->message); g_error_free (error); } - g_object_unref(proxy); return FALSE; } From 3027b2e231b0fcefa9ab7c58bef163f1e967ee2b Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Wed, 2 Oct 2024 12:03:58 +0200 Subject: [PATCH 3/4] button: Don't error-out on dbus communication failure --- src/gpm-button.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gpm-button.c b/src/gpm-button.c index c440c5b1..c2e0532d 100644 --- a/src/gpm-button.c +++ b/src/gpm-button.c @@ -270,9 +270,9 @@ gpm_button_is_lid_closed (GpmButton *button) NULL, &error ); if (proxy == NULL) { - g_error("Error connecting to dbus - %s", error->message); + g_warning ("Error connecting to dbus - %s", error->message); g_error_free (error); - return -1; + goto err; } res = g_dbus_proxy_call_sync (proxy, "Get", @@ -292,15 +292,16 @@ gpm_button_is_lid_closed (GpmButton *button) g_variant_unref (res); return lid; } else if (error != NULL ) { - g_error ("Error in dbus - %s", error->message); + g_warning ("Error in dbus - %s", error->message); g_error_free (error); + goto err; } return FALSE; } - else { - return up_client_get_lid_is_closed (button->priv->client); - } + +err: /* fall back on our client in case of error */ + return up_client_get_lid_is_closed (button->priv->client); } /** From e8abdd43368d824e133e97271c5b89fbdfbd2c4f Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Wed, 2 Oct 2024 12:06:58 +0200 Subject: [PATCH 4/4] brightness: Don't error-out on communication failure No need to exit the whole MPM process when the module doesn't work. --- src/gpm-brightness.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gpm-brightness.c b/src/gpm-brightness.c index a3a05890..b1600bd9 100644 --- a/src/gpm-brightness.c +++ b/src/gpm-brightness.c @@ -131,7 +131,7 @@ gpm_brightness_helper_get_value (const gchar *argument) ret = g_spawn_command_line_sync (command, &stdout_data, NULL, &exit_status, &error); if (!ret) { - g_error ("failed to get value: %s", error->message); + g_warning ("failed to get value: %s", error->message); g_error_free (error); goto out; } @@ -162,7 +162,7 @@ gpm_brightness_helper_set_value (const gchar *argument, gint value) command = g_strdup_printf ("pkexec " SBINDIR "/mate-power-backlight-helper --%s %i", argument, value); ret = g_spawn_command_line_sync (command, NULL, NULL, &exit_status, &error); if (!ret) { - g_error ("failed to get value: %s", error->message); + g_warning ("failed to get value: %s", error->message); g_error_free (error); goto out; } @@ -261,7 +261,7 @@ gpm_brightness_setup_display (GpmBrightness *brightness) /* get the display */ brightness->priv->dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default()); if (!brightness->priv->dpy) { - g_error ("Cannot open display"); + g_critical ("Cannot open display"); return FALSE; } /* is XRandR new enough? */