diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-01-08 20:06:21 +0100 |
---|---|---|
committer | Colin Guthrie <cguthrie@mandriva.org> | 2010-02-09 22:28:17 +0000 |
commit | 66dbca1e06af0607a2d0fc6b8d14ef1ebb034f0a (patch) | |
tree | a15713062e04f6c9dc50a2139e2192a9c3c89c3e /src/modules/bluetooth/module-bluetooth-proximity.c | |
parent | 5e2a80c7e33a9f32058d53c33519197567a9887a (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/module-bluetooth-proximity.c')
-rw-r--r-- | src/modules/bluetooth/module-bluetooth-proximity.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/modules/bluetooth/module-bluetooth-proximity.c b/src/modules/bluetooth/module-bluetooth-proximity.c index c4cfd733..3eed9cea 100644 --- a/src/modules/bluetooth/module-bluetooth-proximity.c +++ b/src/modules/bluetooth/module-bluetooth-proximity.c @@ -92,7 +92,8 @@ struct userdata { unsigned n_found; unsigned n_unknown; - pa_bool_t muted; + pa_bool_t muted:1; + pa_bool_t filter_added:1; }; static void update_volume(struct userdata *u) { @@ -358,9 +359,10 @@ static int add_matches(struct userdata *u, pa_bool_t add) { } else dbus_bus_remove_match(pa_dbus_connection_get(u->dbus_connection), filter2, &e); - if (add) + if (add) { pa_assert_se(dbus_connection_add_filter(pa_dbus_connection_get(u->dbus_connection), filter_func, u, NULL)); - else + u->filter_added = TRUE; + } else if (u->filter_added) dbus_connection_remove_filter(pa_dbus_connection_get(u->dbus_connection), filter_func, u); r = 0; @@ -393,9 +395,6 @@ int pa__init(pa_module*m) { u->sink_name = pa_xstrdup(pa_modargs_get_value(ma, "sink", NULL)); u->hci = pa_xstrdup(pa_modargs_get_value(ma, "hci", DEFAULT_HCI)); u->hci_path = pa_sprintf_malloc("/org/bluez/%s", u->hci); - u->n_found = u->n_unknown = 0; - u->muted = FALSE; - u->bondings = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); if (!(u->dbus_connection = pa_dbus_bus_get(m->core, DBUS_BUS_SYSTEM, &e))) { |