[PACKAGE UPLOAD] 0.0.50
authorEunmi Son <eunmi.son@samsung.com>
Sat, 12 Jan 2013 01:08:08 +0000 (10:08 +0900)
committerEunmi Son <eunmi.son@samsung.com>
Sat, 12 Jan 2013 01:08:08 +0000 (10:08 +0900)
fix prevent defects

Change-Id: I0bbd2a99b8ecb2d8e113c2609fc6a5a56ce8f827

packaging/ug-setting-manage-applications-efl.spec
view/src/mgr-app-view-app-list.c

index 7348404..08ec925 100644 (file)
@@ -3,7 +3,7 @@
 
 Name:          ug-setting-manage-applications-efl
 Summary:       Manage Application package
-Version:       0.0.49
+Version:       0.0.50
 Release:       0
 Group:         Applications/System
 License:       Flora Software License
@@ -24,8 +24,8 @@ BuildRequires: pkgconfig(evas)
 BuildRequires: pkgconfig(glib-2.0)
 BuildRequires: pkgconfig(pkgmgr)
 BuildRequires: pkgconfig(ui-gadget-1)
-BuildRequires: pkgconfig(icu-i18n)
 BuildRequires: pkgconfig(capi-system-sensor)
+BuildRequires: pkgconfig(icu-i18n)
 
 %description
 Description: Manage Application package
index 76e0d59..10763f1 100755 (executable)
@@ -417,11 +417,13 @@ static void _list_update_by_install(char *pkg_type, const char *pkg_name, void *
 {
        MGR_APP_BEGIN();
 
-       ret_if(pkg_type == NULL);
-       ret_if(data == NULL);
+       ret_if(pkg_type == NULL || data == NULL);
+       
        struct ug_data *ugd = (struct ug_data*)data;
        mgr_app_app_info_t *app_info = NULL;
        Elm_Object_Item *item = NULL;
+       char *letter_new = NULL;
+       char *letter = NULL;
        int i = 0;
 
        ret_if(mgr_app_view_app_list.view_common_data == NULL);
@@ -464,8 +466,7 @@ static void _list_update_by_install(char *pkg_type, const char *pkg_name, void *
                        app_info = (mgr_app_app_info_t*)elm_object_item_data_get(item);
                        if (!app_info) {
                                MGR_APP_DEBUG_ERR("app_info is null");
-                               MGR_APP_MEM_FREE(app_info_new);
-                               return;
+                               goto end;
                        }
 
                        int len = 0;
@@ -475,14 +476,20 @@ static void _list_update_by_install(char *pkg_type, const char *pkg_name, void *
 
                                Elm_Object_Item *prev_item = elm_genlist_item_prev_get(item);
                                Elm_Object_Item *new_item = elm_genlist_item_insert_before(app_list_view_data->genlist, itc, (void*)app_info_new, NULL, item, ELM_GENLIST_ITEM_NONE, _gl_sel, (void*)ugd);
-                               ret_if(new_item == NULL);
+                               if (!new_item) {
+                                       MGR_APP_DEBUG_ERR("new_item is null");
+                                       goto end;
+                               }
 
-                               char *letter_new = __convert_char_to_string(app_info_new->app_name[0]);
-                               ret_if(letter_new == NULL);
-                               char *letter = __convert_char_to_string(app_info->app_name[0]);
+                               letter_new = __convert_char_to_string(app_info_new->app_name[0]);
+                               if (!letter_new) {
+                                       MGR_APP_DEBUG_ERR("letter_new is null");
+                                       goto end;
+                               }
+                               letter = __convert_char_to_string(app_info->app_name[0]);
                                if (!letter) {
-                                       MGR_APP_MEM_FREE(letter_new);
-                                       return;
+                                       MGR_APP_DEBUG_ERR("letter is null");
+                                       goto end;
                                }
 
                                /* the top of item */
@@ -498,15 +505,14 @@ static void _list_update_by_install(char *pkg_type, const char *pkg_name, void *
 
                                        mgr_app_app_info_t *app_info_prev = elm_object_item_data_get(prev_item);
                                        if (!app_info_prev) {
-                                               MGR_APP_MEM_FREE(letter);
-                                               MGR_APP_MEM_FREE(letter_new);
-                                               return;
+                                               MGR_APP_DEBUG_ERR("app_info_prev is null");
+                                               goto end;
                                        }
 
                                        char *letter_prev = __convert_char_to_string(app_info_prev->app_name[0]);
                                        if (!letter_prev) {
-                                               MGR_APP_MEM_FREE(letter);
-                                               return;
+                                               MGR_APP_DEBUG_ERR("letter_prev is null");
+                                               goto end;
                                        }
 
                                        if (letter_prev[0] == letter_new[0]) {
@@ -532,24 +538,25 @@ static void _list_update_by_install(char *pkg_type, const char *pkg_name, void *
                                item = elm_genlist_item_next_get(item);
                                if (!item) {
                                        MGR_APP_DEBUG_ERR("item is null");
-                                       MGR_APP_MEM_FREE(app_info_new);
-                                       return;
+                                       goto end;
                                }
 
                                /* check the item and append after last item */
                                if (item == elm_genlist_last_item_get(app_list_view_data->genlist)) {
-                                       char *letter_new = __convert_char_to_string(app_info_new->app_name[0]);
+                                       letter_new = __convert_char_to_string(app_info_new->app_name[0]);
                                        if (!letter_new) {
-                                               MGR_APP_MEM_FREE(app_info_new);
-                                               return;
+                                               MGR_APP_DEBUG_ERR("letter_new is null");
+                                               goto end;
                                        }
 
                                        Elm_Object_Item *new_item = elm_genlist_item_append(app_list_view_data->genlist, itc, (void*)app_info_new, NULL, ELM_GENLIST_ITEM_NONE, _gl_sel, (void*)ugd);
-                                       ret_if(new_item == NULL);
+                                       if (!new_item) {
+                                               MGR_APP_DEBUG_ERR("new_item is null");
+                                               goto end;
+                                       }
 
                                        __register_index_item(app_list_view_data->index, letter_new, new_item, EINA_FALSE);
 
-                                       MGR_APP_MEM_FREE(letter_new);
                                        app_list_view_data->app_info_idx++;
 
                                        break;
@@ -558,16 +565,21 @@ static void _list_update_by_install(char *pkg_type, const char *pkg_name, void *
                }
        /* There are no installed app in list */
        } else {
-               char *letter_new = NULL;
                Elm_Object_Item *new_item = NULL;
 
                elm_genlist_item_append(app_list_view_data->genlist, itc_sep, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
 
                letter_new = __convert_char_to_string(app_info_new->app_name[0]);
-               ret_if(letter_new == NULL);
-
+               if (!letter_new) {
+                       MGR_APP_DEBUG_ERR("letter_new is null");
+                       goto end;
+               }
+       
                new_item = elm_genlist_item_append(app_list_view_data->genlist, itc, (void*)app_info_new, NULL, ELM_GENLIST_ITEM_NONE, _gl_sel, (void*)ugd);
-               ret_if(new_item == NULL);
+               if (!new_item) {
+                       MGR_APP_DEBUG_ERR("new_item is null");
+                       goto end;
+               }
 
                elm_genlist_item_append(app_list_view_data->genlist, itc_sep, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
 
@@ -579,6 +591,11 @@ static void _list_update_by_install(char *pkg_type, const char *pkg_name, void *
 
        elm_genlist_realized_items_update(app_list_view_data->genlist);
 
+end:
+       MGR_APP_MEM_FREE(letter);
+       MGR_APP_MEM_FREE(letter_new);
+       MGR_APP_MEM_FREE(app_info_new);
+       
        MGR_APP_END();
 }
 
@@ -811,6 +828,7 @@ static void _index_del_item_cb(void *data, Evas_Object *obj, void *event_info)
        ret_if(data == NULL);
        Elm_Object_Item *item = (Elm_Object_Item*)data;
        Elm_Object_Item *next_item = elm_genlist_item_next_get(item);
+       char *next_letter = NULL;
 
        ret_if(mgr_app_view_app_list.view_common_data == NULL);
        mgr_app_view_common_data_t *view_common_data = mgr_app_view_app_list.view_common_data;
@@ -823,16 +841,16 @@ static void _index_del_item_cb(void *data, Evas_Object *obj, void *event_info)
                mgr_app_app_info_t *next_app_info = (mgr_app_app_info_t*)elm_object_item_data_get(next_item);
                ret_if(next_app_info == NULL);
 
-               char *next_letter = __convert_char_to_string(next_app_info->app_name[0]);
-               ret_if(next_letter == NULL);
-
                ret_if(event_info == NULL);
                Elm_Object_Item *index_item = (Elm_Object_Item*)event_info;
 
+               next_letter = __convert_char_to_string(next_app_info->app_name[0]);
+               ret_if(next_letter == NULL);
+
                const char *letter = elm_index_item_letter_get(index_item);
                if (!letter) {
-                       MGR_APP_MEM_FREE(next_letter);
-                       return;
+                       MGR_APP_DEBUG_ERR("letter is null.");
+                       goto end;
                }
 
                Elm_Object_Item *prev_item = elm_genlist_item_prev_get(item);
@@ -845,14 +863,14 @@ static void _index_del_item_cb(void *data, Evas_Object *obj, void *event_info)
                } else {
                        mgr_app_app_info_t *prev_app_info = (mgr_app_app_info_t*)elm_object_item_data_get(prev_item);
                        if (!prev_app_info) {
-                               MGR_APP_MEM_FREE(next_letter);
-                               return;
+                               MGR_APP_DEBUG_ERR("prev_app_info is null.");
+                               goto end;
                        }
 
                        char *prev_letter = __convert_char_to_string(prev_app_info->app_name[0]);
                        if (!prev_letter) {
-                               MGR_APP_MEM_FREE(next_letter);
-                               return;
+                               MGR_APP_DEBUG_ERR("prev_letter is null.");
+                               goto end;
                        }
 
                        /* case: A-B'-B-B'', del:B */
@@ -873,6 +891,10 @@ static void _index_del_item_cb(void *data, Evas_Object *obj, void *event_info)
        }
 
        app_list_view_data->index_cnt--;
+
+end:
+       MGR_APP_MEM_FREE(next_letter);
+
        MGR_APP_END();
 }