diff options
author | Christian Fetzer <christian.fetzer@bmw-carit.de> | 2013-09-13 17:28:32 +0200 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2013-09-16 12:59:54 +0300 |
commit | 0c182183c9de71e16c6a7ba370adbbc4fe2a0a14 (patch) | |
tree | b3fe2736f9b12fc830f4b61fff92fa3b298f3670 /obexd | |
parent | 762d52398614a8830ddadec20b536bfdc2ff85c7 (diff) |
obexd: Use pending request in SetFolder
Diffstat (limited to 'obexd')
-rw-r--r-- | obexd/client/map.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/obexd/client/map.c b/obexd/client/map.c index f969aade1..1b2b25dea 100644 --- a/obexd/client/map.c +++ b/obexd/client/map.c @@ -162,18 +162,18 @@ static void simple_cb(struct obc_session *session, struct obc_transfer *transfer, GError *err, void *user_data) { + struct pending_request *request = user_data; DBusMessage *reply; - struct map_data *map = user_data; if (err != NULL) - reply = g_dbus_create_error(map->msg, + reply = g_dbus_create_error(request->msg, ERROR_INTERFACE ".Failed", "%s", err->message); else - reply = dbus_message_new_method_return(map->msg); + reply = dbus_message_new_method_return(request->msg); g_dbus_send_message(conn, reply); - dbus_message_unref(map->msg); + pending_request_free(request); } static DBusMessage *map_setpath(DBusConnection *connection, @@ -181,6 +181,7 @@ static DBusMessage *map_setpath(DBusConnection *connection, { struct map_data *map = user_data; const char *folder; + struct pending_request *request; GError *err = NULL; if (dbus_message_get_args(message, NULL, DBUS_TYPE_STRING, &folder, @@ -189,18 +190,19 @@ static DBusMessage *map_setpath(DBusConnection *connection, ERROR_INTERFACE ".InvalidArguments", NULL); - obc_session_setpath(map->session, folder, simple_cb, map, &err); + request = pending_request_new(map, message); + + obc_session_setpath(map->session, folder, simple_cb, request, &err); if (err != NULL) { DBusMessage *reply; reply = g_dbus_create_error(message, ERROR_INTERFACE ".Failed", "%s", err->message); g_error_free(err); + pending_request_free(request); return reply; } - map->msg = dbus_message_ref(message); - return NULL; } |