fixed N_SE-47370
authorMyoungJune Park <mj2004.park@samsung.com>
Wed, 31 Jul 2013 01:37:37 +0000 (10:37 +0900)
committerMyoungJune Park <mj2004.park@samsung.com>
Wed, 31 Jul 2013 01:37:37 +0000 (10:37 +0900)
"setting-plugin-efl has closed unexpectedly" popup shows
if try to open IME keyboard's setting page after removing all elements.

setting-common/include/setting-common-plugin.h
setting-common/src/setting-common-plugin.c
setting-plugin/src/setting-plugin-main.c

index ac10262..e8d4b5c 100755 (executable)
@@ -92,6 +92,8 @@ struct PluginNode
        // ug
        Evas_Object* win_main_layout;
        ui_gadget_h ug;
+
+       int nitems;
 };
 
 PluginNode* setting_plugin_create(Evas_Object* navi, Evas_Object* win);
index 34e00d8..19caa5e 100755 (executable)
@@ -1169,6 +1169,18 @@ static void __expanditem_func_smart_cb(void *data, Evas_Object *obj, void *event
 
 static void* settings_func(void *data, xmlNode *xmlObj)
 {
+       SETTING_TRACE_BEGIN;
+       retv_if(!data || !xmlObj, NULL);
+       PluginNode* node = (PluginNode*)data;
+
+       int count = 0;
+       count = node->nitems;
+
+       if (count == 1)         // if there's <settings> only
+       {
+               SETTING_TRACE("there's only <settings>");
+               setting_func(data, xmlObj);
+       }
        return NULL;
 }
 
@@ -1204,10 +1216,10 @@ static void* setting_func(void *data, xmlNode *xmlObj)
        PluginNode* node = (PluginNode*)data;
        Draw_Data *pd = node->pd;
 
-       // [DATA] title, btn[0], btn[1]
+       // [DATA] title
        const char *title = (char*)xmlGetProp(xmlObj, "title");
-       char *btn[2] = {/* 0 */"OK", /* 1 */"NO"};
-
+       if (!title)
+               title = "NONAME";
        SETTING_TRACE("before setting_create_layout_navi_bar_genlist");
 
        // [UI] with DATA
@@ -1278,7 +1290,23 @@ static void* expandlist_func(void *data, xmlNode *xmlObj)
        return list_item;
 }
 
+static int __node_walk_check(PluginNode* context, xmlNode* cur, int* pcount)
+{
+       //SETTING_TRACE_BEGIN;
+       Draw_Data *pd = context->pd;
+       retv_if(!pd, -1);
+       retv_if(!context->ui_list, -1);
 
+       xmlNode *cur_node = NULL;
+       for (cur_node = cur; cur_node;cur_node = cur_node->next) {
+               if (cur_node->type == XML_ELEMENT_NODE) {
+                       //SETTING_TRACE("node type : %s id= %s", cur_node->name,xmlGetProp(cur_node, "id"));
+                       *pcount += 1;
+               }
+               __node_walk_check(context, cur_node->children, pcount);         /* RECURSIVE */
+       }
+       return 0;
+}
 
 static int __node_walker(PluginNode* context, xmlNode* cur)
 {
@@ -1528,6 +1556,7 @@ PluginNode* setting_plugin_create(Evas_Object* navi, Evas_Object* win)
 
        setting_retvm_if(!pd, -1, "Create Draw_Data obj failed");
        plugin->ug = NULL;
+       plugin->ly_main = NULL;
        plugin->pd = pd;
        plugin->navi_bar = navi;
        plugin->win_main = win;
@@ -1661,7 +1690,10 @@ int setting_plugin_load(PluginNode* node, const char *cfg_file)
                return -1;
        }
 
-       // TODO: error handler here
+       int count = 0;
+       __node_walk_check(node, node->pd->root, &count);
+       SETTING_TRACE(" node count : %d ", count);
+       node->nitems = count;
        __node_walker(node, node->pd->root);
 
        // debug message
index 4c67ab0..38faedb 100755 (executable)
@@ -109,6 +109,11 @@ static int setting_plugin_main_create(void *cb)
                SETTING_TRACE(" >>> plugin_load OK");
        }
        ad->ly_main = plugin_node->ly_main;
+       if(!ad->ly_main)
+       {
+               SETTING_TRACE(" ad->ly_main is NULL !!!! go to error handle");
+               goto errorhandle;
+       }
 
        ad->plugin_node = plugin_node; // the selected plugin name
 #endif
@@ -116,6 +121,7 @@ static int setting_plugin_main_create(void *cb)
        setting_view_plugin_main.is_create = 1;
        return SETTING_RETURN_SUCCESS;
 errorhandle:
+               //setting_plugin_main_destroy(ad);
                // resource free
                return SETTING_RETURN_FAIL;
 }