From b00a6a44e4023197fb44260fbe3d4bb665b8a490 Mon Sep 17 00:00:00 2001 From: Genie Kim Date: Tue, 11 Sep 2012 21:50:09 +0900 Subject: [PATCH 1/1] fix crash when resume cb is called --- libug-setting-location-efl-appman.c | 25 ++++++++++++++++--------- libug-setting-location-efl.c | 8 +++----- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/libug-setting-location-efl-appman.c b/libug-setting-location-efl-appman.c index 2dfd2f6..dafe1f7 100644 --- a/libug-setting-location-efl-appman.c +++ b/libug-setting-location-efl-appman.c @@ -99,7 +99,11 @@ void setting_location_delete_app_list(Evas_Object *genlist, struct ug_data *ugd) elm_object_item_del(ugd->gi_line); elm_genlist_item_class_free(ugd->itc_line); } - + + if (ugd->app_info == NULL) { + return; + } + for (i = 0; i < ugd->app_count; i++) { if (ugd->app_info[i].gi_app != NULL) { elm_object_item_del(ugd->app_info[i].gi_app); @@ -109,9 +113,16 @@ void setting_location_delete_app_list(Evas_Object *genlist, struct ug_data *ugd) } } - if (ugd->app_info != NULL) { - free(ugd->app_info); - } + free(ugd->app_info); +} + +void setting_location_appman_init(struct ug_data *ugd) +{ + ugd->app_info = NULL; + ugd->itc_line = NULL; + ugd->itc_msg = NULL; + ugd->gi_msg = NULL; + ugd->gi_line = NULL; } int setting_location_get_location_app_list(Evas_Object *genlist, struct ug_data *ugd) @@ -124,7 +135,7 @@ int setting_location_get_location_app_list(Evas_Object *genlist, struct ug_data LOC_LOG("Fail to location_appman_get_app_list"); return FALSE; } - + setting_location_appman_init(ugd); LOC_LOG("app count : %d", ugd->app_count); if (ugd->app_count <= 0) { LOC_LOG("There is no location application in DB"); @@ -133,10 +144,6 @@ int setting_location_get_location_app_list(Evas_Object *genlist, struct ug_data if (ugd->app_count == 1 && (strcmp(app_list[0].package, "org.tizen.setting") == 0)) { LOC_LOG("Setting application is only one location application"); - ugd->itc_line = NULL; - ugd->itc_msg = NULL; - ugd->gi_msg = NULL; - ugd->gi_line = NULL; return TRUE; } diff --git a/libug-setting-location-efl.c b/libug-setting-location-efl.c index a6c7fd1..82b133c 100644 --- a/libug-setting-location-efl.c +++ b/libug-setting-location-efl.c @@ -66,7 +66,7 @@ void setting_location_check_di(void *data) elm_object_item_disabled_set(ugd->gi_mypos, !(ugd->is_gps || ugd->is_net)); - if (ugd->app_count <= 1) { + if (ugd->app_info == NULL) { return; } @@ -97,15 +97,13 @@ static void setting_location_back_cb(void *data, Evas_Object * obj, void *event_ setting_location_free_itc(ugd->itc_mypos); setting_location_free_itc(ugd->itc_msg); setting_location_free_itc(ugd->itc_line); - if (ugd->app_count > 1) { + if (ugd->app_info != NULL) { for (i = 0; i < ugd->app_count; i++) { setting_location_free_itc(ugd->app_info[i].itc_app); } - } - - if (ugd->app_info != NULL) { free(ugd->app_info); } + ug_destroy_me(ugd->ug); } -- 2.7.4