dbus: System bus is optional, we only need a session bus (thanks, tamo!).
authorRyan C. Gordon <icculus@icculus.org>
Thu, 26 Mar 2020 20:28:04 -0400
changeset 13675e3844f61860a
parent 13674 9adcb74f0be2
child 13676 9c0592cc3e92
dbus: System bus is optional, we only need a session bus (thanks, tamo!).

Fixes Bugzilla #4795.
src/core/linux/SDL_dbus.c
     1.1 --- a/src/core/linux/SDL_dbus.c	Thu Mar 26 18:47:04 2020 -0400
     1.2 +++ b/src/core/linux/SDL_dbus.c	Thu Mar 26 20:28:04 2020 -0400
     1.3 @@ -125,18 +125,24 @@
     1.4          }
     1.5  
     1.6          dbus.error_init(&err);
     1.7 +        /* session bus is required */
     1.8 +
     1.9          dbus.session_conn = dbus.bus_get_private(DBUS_BUS_SESSION, &err);
    1.10 -        if (!dbus.error_is_set(&err)) {
    1.11 -            dbus.system_conn = dbus.bus_get_private(DBUS_BUS_SYSTEM, &err);
    1.12 -        }
    1.13          if (dbus.error_is_set(&err)) {
    1.14              dbus.error_free(&err);
    1.15              SDL_DBus_Quit();
    1.16              is_dbus_available = SDL_FALSE;
    1.17              return;  /* oh well */
    1.18          }
    1.19 -        dbus.connection_set_exit_on_disconnect(dbus.system_conn, 0);
    1.20          dbus.connection_set_exit_on_disconnect(dbus.session_conn, 0);
    1.21 +
    1.22 +        /* system bus is optional */
    1.23 +        dbus.system_conn = dbus.bus_get_private(DBUS_BUS_SYSTEM, &err);
    1.24 +        if (!dbus.error_is_set(&err)) {
    1.25 +            dbus.connection_set_exit_on_disconnect(dbus.system_conn, 0);
    1.26 +        }
    1.27 +
    1.28 +        dbus.error_free(&err);
    1.29      }
    1.30  }
    1.31