From 369e5f33fba36aaeb057d7cc3c06d5cdb8018b2b Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Thu, 26 Mar 2020 20:28:04 -0400 Subject: [PATCH] dbus: System bus is optional, we only need a session bus (thanks, tamo!). Fixes Bugzilla #4795. --- src/core/linux/SDL_dbus.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/core/linux/SDL_dbus.c b/src/core/linux/SDL_dbus.c index 13880cb68..8a279b474 100644 --- a/src/core/linux/SDL_dbus.c +++ b/src/core/linux/SDL_dbus.c @@ -125,18 +125,24 @@ SDL_DBus_Init(void) } dbus.error_init(&err); + /* session bus is required */ + dbus.session_conn = dbus.bus_get_private(DBUS_BUS_SESSION, &err); - if (!dbus.error_is_set(&err)) { - dbus.system_conn = dbus.bus_get_private(DBUS_BUS_SYSTEM, &err); - } if (dbus.error_is_set(&err)) { dbus.error_free(&err); SDL_DBus_Quit(); is_dbus_available = SDL_FALSE; return; /* oh well */ } - dbus.connection_set_exit_on_disconnect(dbus.system_conn, 0); dbus.connection_set_exit_on_disconnect(dbus.session_conn, 0); + + /* system bus is optional */ + dbus.system_conn = dbus.bus_get_private(DBUS_BUS_SYSTEM, &err); + if (!dbus.error_is_set(&err)) { + dbus.connection_set_exit_on_disconnect(dbus.system_conn, 0); + } + + dbus.error_free(&err); } }