Fix calling duplicated result callback 95/124595/2
authorSuyeon Hwang <stom.hwang@samsung.com>
Wed, 12 Apr 2017 01:51:23 +0000 (10:51 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Wed, 12 Apr 2017 02:52:14 +0000 (11:52 +0900)
Change-Id: I3c1b2a49bb2aa1d0e795c1811a4d1ccee83cc12b
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
common/vc_cmd_db.c
server/vcd_server.c

index 4218894..30e0266 100644 (file)
@@ -989,7 +989,8 @@ int __vc_db_get_result_pid_list(const char* result, GSList** pid_list)
 
        int ret = 0;
        sqlite3_stmt* stmt = NULL;
-       const char* sql = "SELECT * FROM vc_result WHERE result = ? COLLATE NOCASE;";
+       const char* sql = "SELECT DISTINCT pid, type FROM vc_result WHERE result = ? COLLATE NOCASE ORDER BY pid ASC;";
+
 
        ret = sqlite3_prepare_v2(db_handle, sql, -1, &stmt, NULL);
        if (ret != SQLITE_OK) {
@@ -1031,12 +1032,9 @@ int __vc_db_get_result_pid_list(const char* result, GSList** pid_list)
                }
 
                temp = sqlite3_column_int(stmt, 0);
-               temp_cmd->id = temp;
-
-               temp = sqlite3_column_int(stmt, 5);
                temp_cmd->pid = temp;
 
-               temp = sqlite3_column_int(stmt, 6);
+               temp = sqlite3_column_int(stmt, 1);
                temp_cmd->type = temp;
 
                temp_pid_list = g_slist_append(temp_pid_list, temp_cmd);
index de53304..26f4b7c 100755 (executable)
@@ -387,12 +387,14 @@ static Eina_Bool __vcd_send_selected_result(void *data)
                        GSList* iter = NULL;
                        vc_cmd_s* temp_cmd = NULL;
                        int ret = 0;
+                       int pre_pid = -1;
+                       int pre_type = -1;
 
                        iter = g_slist_nth(pid_list, 0);
                        while (NULL != iter) {
                                temp_cmd = iter->data;
 
-                               if (NULL != temp_cmd) {
+                               if (NULL != temp_cmd && (pre_pid != temp_cmd->pid || pre_type == VC_COMMAND_TYPE_WIDGET || temp_cmd->type == VC_COMMAND_TYPE_WIDGET)) {
                                        /* Launch deactivated several apps that is matched with result */
                                        ret = __vcd_launch_app(result);
                                        if (0 != ret) {
@@ -405,6 +407,8 @@ static Eina_Bool __vcd_send_selected_result(void *data)
                                                        break;
                                                } else {
                                                        SLOG(LOG_DEBUG, TAG_VCD, "[Server] Send result : pid(%d) type(%d)", temp_cmd->pid, temp_cmd->type);
+                                                       pre_pid = temp_cmd->pid;
+                                                       pre_type = temp_cmd->type;
                                                }
                                        }
                                        free(temp_cmd);