From 197b5b55e4d32969591135fe9650eb523ad5c694 Mon Sep 17 00:00:00 2001 From: DoHyun Pyun Date: Tue, 11 Sep 2012 11:18:20 +0900 Subject: [PATCH] 1. Allocate memory for the authorized file name [Comment] The string from FRWK will be freed, so we can't use this address value 2. Fix the crash issue - Step a. OPC file sending failed (More than 2) b. Launch outbound list c. Retry file sending for first item and immediately retry file sending for second item - Issue bluetooth-share got crashed - Cause Before OPC session is created, second file sending is requested. So second job is failed then we removed all transfer list. - Fix description Check the return value. If BLUETOOTH_ERROR_IN_PROGRESS returned, we are skip the exception code --- bt-share/include/bt-share-ipc.h | 2 +- bt-share/src/bt-share-ipc.c | 32 +++++++++++++++++++++---------- bt-share/src/obex-event-handler.c | 11 +++++++++-- debian/changelog | 8 ++++++++ packaging/bluetooth-share.spec | 2 +- 5 files changed, 41 insertions(+), 14 deletions(-) diff --git a/bt-share/include/bt-share-ipc.h b/bt-share/include/bt-share-ipc.h index c12e6da..90ad36c 100644 --- a/bt-share/include/bt-share-ipc.h +++ b/bt-share/include/bt-share-ipc.h @@ -140,7 +140,7 @@ struct _BtShareMethodClass { gboolean _bt_init_dbus_signal(void); void _free_transfer_info(opc_transfer_info_t *node); void _remove_transfer_info(opc_transfer_info_t *node); -gboolean _request_file_send(opc_transfer_info_t *node); +int _request_file_send(opc_transfer_info_t *node); void _bt_send_message_to_ui(int transfer_id, char *name, int percentage, diff --git a/bt-share/src/bt-share-ipc.c b/bt-share/src/bt-share-ipc.c index f52d31d..024d89f 100644 --- a/bt-share/src/bt-share-ipc.c +++ b/bt-share/src/bt-share-ipc.c @@ -187,28 +187,31 @@ void _remove_transfer_info(opc_transfer_info_t *node) DBG("-\n"); } -gboolean _request_file_send(opc_transfer_info_t *node) +int _request_file_send(opc_transfer_info_t *node) { struct bt_appdata *ad = app_state; + int ret; DBG("+\n"); - retv_if(ad == NULL, FALSE); - retv_if(node == NULL, FALSE); + retv_if(ad == NULL, BLUETOOTH_ERROR_INVALID_PARAM); + retv_if(node == NULL, BLUETOOTH_ERROR_INVALID_PARAM); - if (bluetooth_opc_push_files((bluetooth_device_address_t *)node->addr, - node->file_path) != BLUETOOTH_ERROR_NONE) { - DBG("bluetooth_opc_push_files failed "); - return FALSE; + ret = bluetooth_opc_push_files((bluetooth_device_address_t *)node->addr, + node->file_path); + if (ret != BLUETOOTH_ERROR_NONE) { + DBG("bluetooth_opc_push_files failed : %d", ret); + return ret; } __bt_create_send_data(node); DBG("-\n"); - return TRUE; + return BLUETOOTH_ERROR_NONE; } static DBusHandlerResult __event_filter(DBusConnection *sys_conn, DBusMessage *msg, void *data) { + int ret; char *member; const char *path = dbus_message_get_path(msg); @@ -217,6 +220,7 @@ static DBusHandlerResult __event_filter(DBusConnection *sys_conn, if (path == NULL || strcmp(path, "/") == 0) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + member = (char *)dbus_message_get_member(msg); DBG("member (%s)\n", member); @@ -231,8 +235,12 @@ static DBusHandlerResult __event_filter(DBusConnection *sys_conn, node = __add_transfer_info(msg); if (node == NULL) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + if (bluetooth_opc_session_is_exist() == FALSE) { - if (!_request_file_send(node)) { + ret = _request_file_send(node); + if (ret == BLUETOOTH_ERROR_IN_PROGRESS) { + DBG("Aleady OPC progressing. Once completed previous job, will be started\n"); + } else if ( ret != BLUETOOTH_ERROR_NONE) { _bt_create_warning_popup(BLUETOOTH_ERROR_INTERNAL); g_slist_free_full(bt_transfer_list, (GDestroyNotify)_free_transfer_info); @@ -262,8 +270,12 @@ static DBusHandlerResult __event_filter(DBusConnection *sys_conn, node = __add_transfer_info(msg); if (node == NULL) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + if (bluetooth_opc_session_is_exist() == FALSE) { - if (!_request_file_send(node)) { + ret = _request_file_send(node); + if (ret == BLUETOOTH_ERROR_IN_PROGRESS) { + DBG("Aleady OPC progressing. Once completed previous job, will be started\n"); + } else if ( ret != BLUETOOTH_ERROR_NONE) { _bt_create_warning_popup(BLUETOOTH_ERROR_INTERNAL); g_slist_free_full(bt_transfer_list, (GDestroyNotify)_free_transfer_info); diff --git a/bt-share/src/obex-event-handler.c b/bt-share/src/obex-event-handler.c index 6ebf2e7..7bbbab3 100644 --- a/bt-share/src/obex-event-handler.c +++ b/bt-share/src/obex-event-handler.c @@ -71,6 +71,7 @@ static char *__get_file_name(int cnt, char **path) void _bt_share_event_handler(int event, bluetooth_event_param_t *param, void *user_data) { + int ret; static int send_cnt = 0; static char *name = NULL; char str[NOTIFICATION_TEXT_LEN_MAX] = { 0 }; @@ -90,6 +91,8 @@ void _bt_share_event_handler(int event, bluetooth_event_param_t *param, switch (event) { case BLUETOOTH_EVENT_DISABLED: + g_free(server_auth_info.filename); + server_auth_info.filename = NULL; _bt_terminate_app(); break; @@ -263,7 +266,8 @@ void _bt_share_event_handler(int event, bluetooth_event_param_t *param, DBG("gList len : %d\n", g_slist_length(bt_transfer_list)); if (g_slist_length(bt_transfer_list) > 0) { DBG("One more job existed !!\n"); - if (!_request_file_send(bt_transfer_list->data)) { + ret = _request_file_send(bt_transfer_list->data); + if (ret != BLUETOOTH_ERROR_NONE) { g_slist_free_full(bt_transfer_list, (GDestroyNotify)_free_transfer_info); bt_transfer_list = NULL; @@ -274,8 +278,11 @@ void _bt_share_event_handler(int event, bluetooth_event_param_t *param, case BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_AUTHORIZE: DBG("BT_EVENT_OBEX_TRANSFER_AUTHORIZE \n"); if (param->result == BLUETOOTH_ERROR_NONE) { + g_free(server_auth_info.filename); + server_auth_info.filename = NULL; + auth_info = param->param_data; - server_auth_info.filename = auth_info->filename; + server_auth_info.filename = g_strdup(auth_info->filename); server_auth_info.length = auth_info->length; if (server_auth_info.filename) __bt_obex_file_push_auth(&server_auth_info); diff --git a/debian/changelog b/debian/changelog index d42a6b3..f5d3ca9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +bluetooth-share (0.0.26) unstable; urgency=low + + * Upload the package + * Git: slp/pkgs/b/bluetooth-share + * Tag: bluetooth-share_0.0.26 + + -- DoHyun Pyun Tue, 11 Sep 2012 11:05:27 +0900 + bluetooth-share (0.0.25) unstable; urgency=low * Upload the package diff --git a/packaging/bluetooth-share.spec b/packaging/bluetooth-share.spec index 076b5ae..a17d06c 100644 --- a/packaging/bluetooth-share.spec +++ b/packaging/bluetooth-share.spec @@ -2,7 +2,7 @@ Name: bluetooth-share Summary: Bluetooth file share Agent -Version: 0.0.25 +Version: 0.0.26 Release: 1 Group: TO_BE/FILLED_IN License: TO BE FILLED IN -- 2.34.1