summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/modules/reserve.c22
-rw-r--r--src/modules/reserve.h2
2 files changed, 9 insertions, 15 deletions
diff --git a/src/modules/reserve.c b/src/modules/reserve.c
index 9a9591d2..09bc46cb 100644
--- a/src/modules/reserve.c
+++ b/src/modules/reserve.c
@@ -43,16 +43,15 @@ struct rd_device {
DBusConnection *connection;
- int owning:1;
- int registered:1;
- int filtering:1;
- int gave_up:1;
+ unsigned owning:1;
+ unsigned registered:1;
+ unsigned filtering:1;
+ unsigned gave_up:1;
rd_request_cb_t request_cb;
void *userdata;
};
-
#define SERVICE_PREFIX "org.freedesktop.ReserveDevice1."
#define OBJECT_PREFIX "/org/freedesktop/ReserveDevice1/"
@@ -297,6 +296,7 @@ static DBusHandlerResult filter_handler(
dbus_error_init(&error);
d = userdata;
+ assert(d->ref >= 1);
if (dbus_message_is_signal(m, "org.freedesktop.DBus", "NameLost")) {
const char *name;
@@ -560,7 +560,7 @@ void rd_release(
assert(d->ref > 0);
- if (--d->ref)
+ if (--d->ref > 0)
return;
@@ -575,17 +575,11 @@ void rd_release(
d->connection,
d->object_path);
- if (d->owning) {
- DBusError error;
- dbus_error_init(&error);
-
+ if (d->owning)
dbus_bus_release_name(
d->connection,
d->service_name,
- &error);
-
- dbus_error_free(&error);
- }
+ NULL);
free(d->device_name);
free(d->application_name);
diff --git a/src/modules/reserve.h b/src/modules/reserve.h
index b315a08c..31071298 100644
--- a/src/modules/reserve.h
+++ b/src/modules/reserve.h
@@ -45,7 +45,7 @@ typedef int (*rd_request_cb_t)(
* the error was caused D-Bus. */
int rd_acquire(
rd_device **d, /* On success a pointer to the newly allocated rd_device object will be filled in here */
- DBusConnection *connection,
+ DBusConnection *connection, /* Session bus (when D-Bus learns about user busses we should switchg to user busses) */
const char *device_name, /* The device to lock, e.g. "Audio0" */
const char *application_name, /* A human readable name of the application, e.g. "PulseAudio Sound Server" */
int32_t priority, /* The priority for this application. If unsure use 0 */