Fix segmentation fault 26/143026/4 submit/tizen/20170817.073026
authorsooyeon.kim <sooyeon.kim@samsung.com>
Tue, 8 Aug 2017 07:55:45 +0000 (16:55 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Mon, 14 Aug 2017 08:15:04 +0000 (17:15 +0900)
Change-Id: I9e4b841f310bed8d9964c873d96866e97524de82
Signed-off-by: sooyeon.kim <sooyeon.kim@samsung.com>
src/vc_elm_core.c
src/vc_elm_efl_dump.c

index b23aec2..3bdc4e5 100644 (file)
@@ -1271,38 +1271,44 @@ static int __vc_add_commands_for_automode_vt_auto()
                                        VC_ELM_LOG_DBG("x(%d) y(%d) w(%d) h(%d)", info->geometry_info.x, info->geometry_info.y, info->geometry_info.w, info->geometry_info.h);
                                        Object_Info* parent = ea_object_dump_parent_widget_data_get(info);
                                        Object_Info* grand = ea_object_dump_parent_widget_data_get(parent);
-
-                                       const char *widget_type = NULL;
-                                       widget_type = elm_widget_type_get((const Evas_Object*)grand->address);
-                                       while (NULL == widget_type) {
-                                               grand = ea_object_dump_parent_widget_data_get(grand);
-                                               if (NULL == grand) {
-                                                       break;
-                                               }
+                                       if (NULL != parent && NULL != grand) {
+                                               const char *widget_type = NULL;
                                                widget_type = elm_widget_type_get((const Evas_Object*)grand->address);
-                                       }
-
-                                       VC_ELM_LOG_DBG("info(%s) parent(%s) grand(%s)", elm_widget_type_get((Evas_Object*)info->address), elm_widget_type_get((Evas_Object*)parent->address), widget_type);
-                                       // VC_ELM_LOG_DBG("info(%s) parent(%s) grand(%s)", evas_object_type_get((Evas_Object*)info->address), evas_object_type_get((Evas_Object*)parent->address), evas_object_type_get((Evas_Object*)grand->address));
-
-                                       if (NULL != widget_type && (!strcmp(widget_type, "Elm_Genlist") || !strcmp(widget_type, "Elm_Gengrid") || !strcmp(widget_type, "Elm_List"))) {
-                                               int x = info->geometry_info.x;
-                                               int y = info->geometry_info.y;
-                                               int w = info->geometry_info.w;
-                                               int h = info->geometry_info.h;
-                                               Elm_Object_Item *it = __vc_elm_core_get_object_item_from_geometry_info((Evas_Object*)grand->address, widget_type, x, y, w, h);
-                                               if (NULL != it) {
-                                                       _vc_elm_core_set_auto_item_object_command(it, info->text);
-                                                       VC_ELM_LOG_DBG("Get object from geometry(%p)", it);
+                                               while (NULL == widget_type) {
+                                                       grand = ea_object_dump_parent_widget_data_get(grand);
+                                                       if (NULL == grand) {
+                                                               break;
+                                                       }
+                                                       widget_type = elm_widget_type_get((const Evas_Object*)grand->address);
                                                }
-                                       } else if (NULL != widget_type && (!strcmp(widget_type, "Elm_Toolbar"))) {
-                                               Elm_Object_Item *it = elm_toolbar_item_find_by_label((Evas_Object*)grand->address, info->text);
-                                               if (NULL != it) {
-                                                       _vc_elm_core_set_auto_item_object_command(it, info->text);
-                                                       VC_ELM_LOG_DBG("Get object from label(%p)", it);
+
+                                               VC_ELM_LOG_DBG("info(%s) parent(%s) grand(%s)", elm_widget_type_get((Evas_Object*)info->address), elm_widget_type_get((Evas_Object*)parent->address), widget_type);
+                                               // VC_ELM_LOG_DBG("info(%s) parent(%s) grand(%s)", evas_object_type_get((Evas_Object*)info->address), evas_object_type_get((Evas_Object*)parent->address), evas_object_type_get((Evas_Object*)grand->address));
+
+                                               if (NULL != widget_type && (!strcmp(widget_type, "Elm_Genlist") || !strcmp(widget_type, "Elm_Gengrid") || !strcmp(widget_type, "Elm_List"))) {
+                                                       int x = info->geometry_info.x;
+                                                       int y = info->geometry_info.y;
+                                                       int w = info->geometry_info.w;
+                                                       int h = info->geometry_info.h;
+                                                       Elm_Object_Item *it = __vc_elm_core_get_object_item_from_geometry_info((Evas_Object*)grand->address, widget_type, x, y, w, h);
+                                                       if (NULL != it) {
+                                                               _vc_elm_core_set_auto_item_object_command(it, info->text);
+                                                               VC_ELM_LOG_DBG("Get object from geometry(%p)", it);
+                                                       }
+                                               } else if (NULL != widget_type && (!strcmp(widget_type, "Elm_Toolbar"))) {
+                                                       Elm_Object_Item *it = elm_toolbar_item_find_by_label((Evas_Object*)grand->address, info->text);
+                                                       if (NULL != it) {
+                                                               _vc_elm_core_set_auto_item_object_command(it, info->text);
+                                                               VC_ELM_LOG_DBG("Get object from label(%p)", it);
+                                                       }
+                                               } else if (NULL != widget_type && (!strcmp(widget_type, "Elm_Ctxpopup"))) {
+                                                       /* TODO */
+                                               } else {
+                                                       if (!_vc_elm_core_register_default_widget(_get_ui_object_name((Evas_Object*)info->address), EINA_FALSE, NULL) || (NULL == eina_hash_find(_vc_elm_core_get_config_widget_map(), elm_widget_type_get((Evas_Object*)info->address)))) {
+                                                               VC_ELM_LOG_ERR("Not supported widget");
+                                                       }
+                                                       _vc_elm_core_set_auto_object_command((Evas_Object*)info->address, info->text);
                                                }
-                                       } else if (NULL != widget_type && (!strcmp(widget_type, "Elm_Ctxpopup"))) {
-                                               /* TODO */
                                        } else {
                                                if (!_vc_elm_core_register_default_widget(_get_ui_object_name((Evas_Object*)info->address), EINA_FALSE, NULL) || (NULL == eina_hash_find(_vc_elm_core_get_config_widget_map(), elm_widget_type_get((Evas_Object*)info->address)))) {
                                                        VC_ELM_LOG_ERR("Not supported widget");
index 04604f1..a3bafef 100644 (file)
@@ -160,6 +160,10 @@ _edje_file_info_save(Ea_Util_Mgr *util_mgr, const Evas_Object *obj)
                EINA_LIST_FOREACH(parts, l, pname) {
                        if ((pobj = edje_object_part_object_get(obj, pname))) {
                                edje_info = malloc(sizeof(Edje_Info));
+                               if (!edje_info) {
+                                       VC_ELM_LOG_ERR("[ERROR] Fail to allocate memory");
+                                       return;
+                               }
                                edje_info->obj = pobj;
                                edje_info->part_name = strdup(pname);
                                ret = edje_object_part_state_get(obj, edje_info->part_name, &val);
@@ -206,6 +210,10 @@ _obj_tree_items(Ea_Util_Mgr *util_mgr, Evas_Object *obj, Object_Info *parent)
        if (is_clip) goto next;
 
        object_info = calloc(1, sizeof(Object_Info));
+       if (!object_info) {
+               VC_ELM_LOG_ERR("[ERROR] Fail to allocate memory");
+               return;
+       }
 
        object_info->parent = parent;
 
@@ -434,6 +442,10 @@ _obj_tree_items_exclude_unfocusable_text(Ea_Util_Mgr *util_mgr, Evas_Object *obj
        }
 
        object_info = calloc(1, sizeof(Object_Info));
+       if (!object_info) {
+               VC_ELM_LOG_ERR("[ERROR] Fail to allocate memory");
+               return;
+       }
 
        object_info->parent = parent;
 
@@ -575,10 +587,9 @@ _obj_tree_items_exclude_unfocusable_text(Ea_Util_Mgr *util_mgr, Evas_Object *obj
        if (text && strlen(text) > 0) {
                object_info->text = calloc(1, strlen(text) + 1);
                strncpy(object_info->text, text, strlen(text) + 1);
-
-               ret_list = eina_list_append(ret_list, object_info);
        }
-
+`
+       ret_list = eina_list_append(ret_list, object_info);
 next:
        if (!evas_object_type_match(obj, "rectangle") && !evas_object_type_match(obj, "text") && !evas_object_type_match(obj, "image")) {
                children = evas_object_smart_members_get(obj);
@@ -897,6 +908,10 @@ ea_object_dump_find_data(Eina_List *list, const char *str1, const char *str2)
 Object_Info*
 ea_object_dump_parent_widget_data_get(const Object_Info *obj_info)
 {
+       if (NULL == obj_info) {
+               return NULL;
+       }
+
        Object_Info *parent_info = NULL;
 
        parent_info = obj_info->parent;