From 66dbca1e06af0607a2d0fc6b8d14ef1ebb034f0a Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 8 Jan 2010 20:06:21 +0100 Subject: 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 --- src/modules/bluetooth/bluetooth-util.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/modules/bluetooth/bluetooth-util.c') 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); } -- cgit