summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Berg <bberg@redhat.com>2021-03-10 11:43:00 +0100
committerBenjamin Berg <bberg@redhat.com>2021-03-12 19:16:54 +0100
commitc9ac5be7cd6577affcc85f6fb32f677388003e6a (patch)
treeda721b6822d15f411f1085fa4a3ee80dafb6d00a
parentf52368272b0255d3d6b8c6da9ee2b74935d49bd1 (diff)
downloadgdm-benzea/fix-conversation-error-reporting.tar.gz
session: Initialize DBus error domain before resolving errorsbenzea/fix-conversation-error-reporting
We would not initialize the DBus error domain before we retrieved the first error, but only did so to compare the error after receiving them. This means that the first error we received will not be resolved correctly, while all subsequent ones are resolved. Fix this by calling GDM_SESSION_WORKER_ERROR from gdm_session_class_init and add gdm_dbus_error_ensure to make sure this can never be optimized away.
-rw-r--r--daemon/gdm-dbus-util.c14
-rw-r--r--daemon/gdm-dbus-util.h2
-rw-r--r--daemon/gdm-session.c3
3 files changed, 19 insertions, 0 deletions
diff --git a/daemon/gdm-dbus-util.c b/daemon/gdm-dbus-util.c
index b71da7fd..844d60ab 100644
--- a/daemon/gdm-dbus-util.c
+++ b/daemon/gdm-dbus-util.c
@@ -183,3 +183,17 @@ gdm_dbus_get_uid_for_name (const char *system_bus_name,
return retval;
}
+
+void
+gdm_dbus_error_ensure (GQuark domain)
+{
+ /* The primary purpose of this function is to make sure the error quark
+ * is registered internally with gdbus before any bus traffic occurs,
+ * so we get remote errors mapped correctly to their local counterparts.
+ * This error quark registration happens implicitly the first time the
+ * quark is used.
+ * Note that g_debug is never optimized away, only the output is suppressed.
+ */
+ g_debug ("GdmDBusUtils: Registered DBus error domain '%s'",
+ g_quark_to_string (domain));
+}
diff --git a/daemon/gdm-dbus-util.h b/daemon/gdm-dbus-util.h
index 47654de2..32dc3196 100644
--- a/daemon/gdm-dbus-util.h
+++ b/daemon/gdm-dbus-util.h
@@ -35,4 +35,6 @@ gboolean gdm_dbus_get_pid_for_name (const char *system_bus_name,
gboolean gdm_dbus_get_uid_for_name (const char *system_bus_name,
uid_t *out_uid,
GError **error);
+
+void gdm_dbus_error_ensure (GQuark domain);
#endif
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
index a6f00b66..5c5903a4 100644
--- a/daemon/gdm-session.c
+++ b/daemon/gdm-session.c
@@ -3998,6 +3998,9 @@ gdm_session_class_init (GdmSessionClass *session_class)
FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
#endif
+
+ /* Ensure we can resolve errors */
+ gdm_dbus_error_ensure (GDM_SESSION_WORKER_ERROR);
}
GdmSession *