Skip to content

Commit

Permalink
Prevent application exit on D-Bus connection lost
Browse files Browse the repository at this point in the history
By default libdbus library sets exit-on-disconnect flag, which results
in exit(1) being called in case of D-Bus connection lost. But, for our
purpose such behavior is not desired, because it might cause unexpected
application exit without an apparent reason. Client which uses ALSA API
should decide by itself what to do if BT device is not available any
more.
  • Loading branch information
arkq committed Sep 5, 2020
1 parent 2c441f6 commit a918a3f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/shared/dbus-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ dbus_bool_t bluealsa_dbus_connection_ctx_init(
if ((ctx->conn = dbus_bus_get_private(DBUS_BUS_SYSTEM, error)) == NULL)
return FALSE;

/* do not terminate in case of D-Bus connection being lost */
dbus_connection_set_exit_on_disconnect(ctx->conn, FALSE);

if (!dbus_connection_set_watch_functions(ctx->conn, ba_dbus_watch_add,
ba_dbus_watch_del, ba_dbus_watch_toggled, ctx, NULL)) {
dbus_set_error(error, DBUS_ERROR_NO_MEMORY, NULL);
Expand Down

0 comments on commit a918a3f

Please sign in to comment.