summaryrefslogtreecommitdiffstats
path: root/src/modules/bluetooth/bluetooth-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-01-08 20:06:21 +0100
committerLennart Poettering <lennart@poettering.net>2010-01-08 20:06:21 +0100
commitc41ee00893b6b0d5cc48ee041b8e4835eac548f0 (patch)
tree60074e8bf938ce598ff68ecf22aa8726aaf86a12 /src/modules/bluetooth/bluetooth-util.c
parent06327b1e67af661cb3d73598e6f5f51e475e7ce6 (diff)
dbus: remove filter functions only if they were actually set before
This fixes an assert when destructing modules that have not been fully initialized. https://bugzilla.redhat.com/show_bug.cgi?id=548525
Diffstat (limited to 'src/modules/bluetooth/bluetooth-util.c')
-rw-r--r--src/modules/bluetooth/bluetooth-util.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index 47d62005..795d5108 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -37,6 +37,7 @@ struct pa_bluetooth_discovery {
PA_LLIST_HEAD(pa_dbus_pending, pending);
pa_hashmap *devices;
pa_hook hook;
+ pa_bool_t filter_added;
};
static void get_properties_reply(DBusPendingCall *pending, void *userdata);
@@ -788,6 +789,7 @@ pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *c) {
pa_log_error("Failed to add filter function");
goto fail;
}
+ y->filter_added = TRUE;
if (pa_dbus_add_matches(
pa_dbus_connection_get(y->connection), &err,
@@ -856,7 +858,8 @@ void pa_bluetooth_discovery_unref(pa_bluetooth_discovery *y) {
"type='signal',sender='org.bluez',interface='org.bluez.AudioSink',member='PropertyChanged'",
"type='signal',sender='org.bluez',interface='org.bluez.AudioSource',member='PropertyChanged'", NULL);
- dbus_connection_remove_filter(pa_dbus_connection_get(y->connection), filter_cb, y);
+ if (y->filter_added)
+ dbus_connection_remove_filter(pa_dbus_connection_get(y->connection), filter_cb, y);
pa_dbus_connection_unref(y->connection);
}