Bug 830290: Replace calls to dbus_connection_send_with_reply_and_block r=bent,qdot

There is one call to dbus_connection_send_with_reply_and_block in
the Bluetooth code. This patch replaces the call by a call to the
helper function dbus_func_send_and_block, which executes the DBus
operation within the DBus thread.
This commit is contained in:
Thomas Zimmermann 2013-03-11 15:22:50 +01:00
parent a9f9586dbc
commit a013956d88

View File

@ -689,15 +689,12 @@ RegisterLocalAgent(const char* adapterPath,
return false;
}
DBusError err;
dbus_error_init(&err);
DBusError err = DBUS_ERROR_INIT;
DBusMessage* reply;
DBusMessage* reply =
dbus_connection_send_with_reply_and_block(gThreadConnection->GetConnection(),
msg, -1, &err);
dbus_message_unref(msg);
if (!reply) {
dbus_bool_t success = dbus_func_send_and_block(gThreadConnection->GetConnection(),
-1, &reply, &err, msg);
if (!success) {
if (dbus_error_is_set(&err)) {
if (!strcmp(err.name, "org.bluez.Error.AlreadyExists")) {
LOG_AND_FREE_DBUS_ERROR(&err);
@ -710,7 +707,7 @@ RegisterLocalAgent(const char* adapterPath,
return false;
}
}
} else {
} else if (reply) {
dbus_message_unref(reply);
}