1. Allocate memory for the authorized file name 2.0alpha master 2.0_alpha submit/master/20120920.151045
authorDoHyun Pyun <dh79.pyun@samsung.com>
Tue, 11 Sep 2012 02:18:20 +0000 (11:18 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Tue, 11 Sep 2012 02:21:17 +0000 (11:21 +0900)
[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
bt-share/src/bt-share-ipc.c
bt-share/src/obex-event-handler.c
debian/changelog
packaging/bluetooth-share.spec

index c12e6da..90ad36c 100644 (file)
@@ -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,
index f52d31d..024d89f 100644 (file)
@@ -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);
index 6ebf2e7..7bbbab3 100644 (file)
@@ -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);
index d42a6b3..f5d3ca9 100644 (file)
@@ -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 <dh79.pyun@samsung.com>  Tue, 11 Sep 2012 11:05:27 +0900
+
 bluetooth-share (0.0.25) unstable; urgency=low
 
   * Upload the package
index 076b5ae..a17d06c 100644 (file)
@@ -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