[pulseaudio-discuss] [PATCH v0 3/3] bluetooth: Fix sending D-Bus reply before internal callback

Mikel Astiz mikel.astiz.oss at gmail.com
Thu Jan 24 08:48:24 PST 2013


Hi Tanu,

On Thu, Jan 24, 2013 at 3:01 PM, Tanu Kaskinen <tanuk at iki.fi> wrote:
> On Thu, 2013-01-24 at 10:16 +0100, Mikel Astiz wrote:
>> From: Mikel Astiz <mikel.astiz at bmw-carit.de>
>>
>> Make sure the reply to SetConfiguration() is sent before the internal
>> hook is fired. This is important because the hook could have side
>> effects including D-Bus interfactions (i.e. transport Acquire() being
>> called during module startup).
>> ---
>>  src/modules/bluetooth/bluetooth-util.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
>> index 92254f2..1a14c9c 100644
>> --- a/src/modules/bluetooth/bluetooth-util.c
>> +++ b/src/modules/bluetooth/bluetooth-util.c
>> @@ -1356,11 +1356,13 @@ static DBusMessage *endpoint_set_configuration(DBusConnection *conn, DBusMessage
>>      pa_log_debug("Transport %s profile %d available", t->path, t->profile);
>>
>>      pa_assert_se(r = dbus_message_new_method_return(m));
>> +    pa_assert_se(dbus_connection_send(pa_dbus_connection_get(y->connection), r, NULL));
>> +    dbus_message_unref(r);
>>
>>      if (old_any_connected != pa_bluetooth_device_any_audio_connected(d))
>>          run_callback(d, false);
>>
>> -    return r;
>> +    return NULL;
>
> The function returns now always NULL, so the return type should be
> changed to void.

The function might return non-null in case of error, after fail2, but
I could change this if you prefer.

Cheers,
Mikel


More information about the pulseaudio-discuss mailing list