mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-20 22:16:49 +01:00
linux: If D-Bus isn't available on the system, don't keep trying to load it.
Fixes Bugzilla #4476.
This commit is contained in:
parent
cf092eca90
commit
a747106c97
@ -111,8 +111,19 @@ LoadDBUSLibrary(void)
|
|||||||
void
|
void
|
||||||
SDL_DBus_Init(void)
|
SDL_DBus_Init(void)
|
||||||
{
|
{
|
||||||
if (!dbus.session_conn && LoadDBUSLibrary() != -1) {
|
static SDL_bool is_dbus_available = SDL_TRUE;
|
||||||
|
if (!is_dbus_available) {
|
||||||
|
return; /* don't keep trying if this fails. */
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!dbus.session_conn) {
|
||||||
DBusError err;
|
DBusError err;
|
||||||
|
|
||||||
|
if (LoadDBUSLibrary() == -1) {
|
||||||
|
is_dbus_available = SDL_FALSE; /* can't load at all? Don't keep trying. */
|
||||||
|
return; /* oh well */
|
||||||
|
}
|
||||||
|
|
||||||
dbus.error_init(&err);
|
dbus.error_init(&err);
|
||||||
dbus.session_conn = dbus.bus_get_private(DBUS_BUS_SESSION, &err);
|
dbus.session_conn = dbus.bus_get_private(DBUS_BUS_SESSION, &err);
|
||||||
if (!dbus.error_is_set(&err)) {
|
if (!dbus.error_is_set(&err)) {
|
||||||
@ -121,6 +132,7 @@ SDL_DBus_Init(void)
|
|||||||
if (dbus.error_is_set(&err)) {
|
if (dbus.error_is_set(&err)) {
|
||||||
dbus.error_free(&err);
|
dbus.error_free(&err);
|
||||||
SDL_DBus_Quit();
|
SDL_DBus_Quit();
|
||||||
|
is_dbus_available = SDL_FALSE;
|
||||||
return; /* oh well */
|
return; /* oh well */
|
||||||
}
|
}
|
||||||
dbus.connection_set_exit_on_disconnect(dbus.system_conn, 0);
|
dbus.connection_set_exit_on_disconnect(dbus.system_conn, 0);
|
||||||
@ -158,11 +170,7 @@ SDL_DBus_GetContext(void)
|
|||||||
SDL_DBus_Init();
|
SDL_DBus_Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dbus_handle && dbus.session_conn){
|
return (dbus_handle && dbus.session_conn) ? &dbus : NULL;
|
||||||
return &dbus;
|
|
||||||
} else {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static SDL_bool
|
static SDL_bool
|
||||||
|
Loading…
Reference in New Issue
Block a user