[gnome-session/fix-criticals] Fix criticals




commit 6203cc968c00c4c8fc5e5fe45b5105c5571d3dcc
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Aug 16 13:09:49 2022 -0400

    Fix criticals
    
    I see this in my logs:
      gnome-session-binary[1224]: GLib-GIO-CRITICAL: g_bus_get_sync: assertion 'error == NULL || *error == 
NULL' failed
      gnome-session-binary[1224]: GLib-GIO-CRITICAL: g_bus_get_sync: assertion 'error == NULL || *error == 
NULL' failed
    
    After staring at gnome-session code for a while,
    I've concluded that this happens because we sometimes
    fail to clear the error variable that gets reused all
    over main(). So, clear it always.

 gnome-session/main.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/gnome-session/main.c b/gnome-session/main.c
index a460a849..d2a90761 100644
--- a/gnome-session/main.c
+++ b/gnome-session/main.c
@@ -543,8 +543,10 @@ main (int argc, char **argv)
 
 #ifdef HAVE_SYSTEMD
         gsm_util_export_user_environment (&error);
-        if (error && !g_getenv ("RUNNING_UNDER_GDM")) {
-                g_warning ("Failed to upload environment to systemd: %s", error->message);
+        if (error) {
+                if (!g_getenv ("RUNNING_UNDER_GDM")) {
+                        g_warning ("Failed to upload environment to systemd: %s", error->message);
+                }
                 g_clear_error (&error);
         }
 #endif
@@ -567,8 +569,10 @@ main (int argc, char **argv)
                  * in a previous session
                  */
                 gsm_util_systemd_reset_failed (&error);
-                if (error && !g_getenv ("RUNNING_UNDER_GDM")) {
-                        g_warning ("Failed to reset failed state of units: %s", error->message);
+                if (error) {
+                        if (!g_getenv ("RUNNING_UNDER_GDM")) {
+                                g_warning ("Failed to reset failed state of units: %s", error->message);
+                        }
                         g_clear_error (&error);
                 }
 


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