Prevent fix. 07/34207/1
authorSungmin Kwak <sungmin.kwak@samsung.com>
Fri, 16 Jan 2015 05:22:40 +0000 (14:22 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Thu, 22 Jan 2015 05:17:50 +0000 (14:17 +0900)
Change-Id: Ia43c61a10f57e7dc16e7930990426217bd07baca

scl/gwes/efl/sclevents-efl.cpp [changed mode: 0644->0755]
scl/gwes/efl/sclwindows-efl.cpp
scl/sclcontroller.cpp
scl/scleventhandler.cpp
xml2binary/metadata_handler.cpp

old mode 100644 (file)
new mode 100755 (executable)
index 70cd748..d81900a
@@ -356,11 +356,12 @@ Eina_Bool mouse_release (void *data, int type, void *event_info)
 
     //Evas_Event_Mouse_Up *ev = (Evas_Event_Mouse_Up*)event_info;
     Ecore_Event_Mouse_Button *ev = (Ecore_Event_Mouse_Button*)event_info;
-    LOGD("mouse_release : %d %d, %d %d\n", ev->root.x, ev->root.y, ev->x, ev->y);
 
     //if (!mouse_pressed) return FALSE;
 
     if (controller && windows && context && ev) {
+        LOGD("mouse_release : %d %d, %d %d\n", ev->root.x, ev->root.y, ev->x, ev->y);
+
         sclbyte index = 0;
         sclboolean processed = FALSE;
         sclwindow window = SCLWINDOW_INVALID;
@@ -555,7 +556,6 @@ Eina_Bool mouse_move (void *data, int type, void *event_info)
 
     //Evas_Event_Mouse_Move *ev = (Evas_Event_Mouse_Move*)event_info;
     Ecore_Event_Mouse_Move *ev = (Ecore_Event_Mouse_Move*)event_info;
-    LOGD("mouse_move : %d %d, %d %d\n", ev->root.x, ev->root.y, ev->x, ev->y);
 
     //if (!mouse_pressed) return FALSE;
 
@@ -565,6 +565,8 @@ Eina_Bool mouse_move (void *data, int type, void *event_info)
         sclwindow window = SCLWINDOW_INVALID;
         SclRectangle rect;
 
+        LOGD("mouse_move : %d %d, %d %d\n", ev->root.x, ev->root.y, ev->x, ev->y);
+
         if (context->get_cur_pressed_window(ev->multi.device) != SCLWINDOW_INVALID &&
             get_window_rect(context->get_cur_pressed_window(ev->multi.device), &rect)) {
             sclint winwidth = rect.width;
index 8164489..5b778da 100644 (file)
@@ -119,7 +119,7 @@ CSCLWindowsImplEfl::create_base_window(const sclwindow parent, SclWindowContext
     if (window_context) {
         window_context->etc_info = NULL;
         window_context->window = parent;
-    
+
     //Adding window show event handler:mrunal.s
     _candidate_show_handler = ecore_event_handler_add (ECORE_X_EVENT_WINDOW_SHOW, x_event_window_show_cb, NULL);
 
@@ -196,7 +196,7 @@ CSCLWindowsImplEfl::create_window(const sclwindow parent, SclWindowContext *wind
 
     set_window_accepts_focus(win, FALSE);
 
-    /*ecore_x_icccm_transient_for_set(elm_win_xwindow_get(static_cast<Evas_Object*>(win)), 
+    /*ecore_x_icccm_transient_for_set(elm_win_xwindow_get(static_cast<Evas_Object*>(win)),
         elm_win_xwindow_get(static_cast<Evas_Object*>(parent)));*/
 
     Ecore_X_Atom ATOM_WINDOW_EFFECT_ENABLE  = 0;
@@ -277,7 +277,7 @@ CSCLWindowsImplEfl::create_magnifier_window(const sclwindow parent, SclWindowCon
 
     set_window_accepts_focus(win, FALSE);
 
-    /*ecore_x_icccm_transient_for_set(elm_win_xwindow_get(static_cast<Evas_Object*>(win)), 
+    /*ecore_x_icccm_transient_for_set(elm_win_xwindow_get(static_cast<Evas_Object*>(win)),
         elm_win_xwindow_get(static_cast<Evas_Object*>(parent)));*/
 
     Ecore_X_Atom ATOM_WINDOW_EFFECT_ENABLE  = 0;
@@ -334,7 +334,7 @@ CSCLWindowsImplEfl::create_dim_window(const sclwindow parent, SclWindowContext *
 
     set_window_accepts_focus(win, FALSE);
 
-    /*ecore_x_icccm_transient_for_set(elm_win_xwindow_get(static_cast<Evas_Object*>(win)), 
+    /*ecore_x_icccm_transient_for_set(elm_win_xwindow_get(static_cast<Evas_Object*>(win)),
         elm_win_xwindow_get(static_cast<Evas_Object*>(parent)));*/
 
     Ecore_X_Atom ATOM_WINDOW_EFFECT_ENABLE  = 0;
@@ -386,7 +386,7 @@ CSCLWindowsImplEfl::set_parent(const sclwindow parent, const sclwindow window)
     SCL_DEBUG();
 
     if (parent && window) {
-        ecore_x_icccm_transient_for_set(elm_win_xwindow_get(static_cast<Evas_Object*>(window)), 
+        ecore_x_icccm_transient_for_set(elm_win_xwindow_get(static_cast<Evas_Object*>(window)),
                 elm_win_xwindow_get(static_cast<Evas_Object*>(parent)));
     }
 }
@@ -410,82 +410,78 @@ CSCLWindowsImplEfl::destroy_window(sclwindow window)
     CSCLUtils *utils = CSCLUtils::get_instance();
 
     SclWindowContext *window_context = NULL;
-    if (windows && window) {
+    if (windows && window && utils) {
         window_context = windows->get_window_context(window);
-    }
-
-    utils->log("WinEfl_destroywin %p %p (basewin %p mag %p)\n",
-        window,
-        (window_context && !(window_context->is_virtual)) ? elm_win_xwindow_get(static_cast<Evas_Object*>(window)) : 0x01,
-        windows->get_base_window(), windows->get_magnifier_window());
-
-    if (windows && utils && window_context) {
-        if (window_context->etc_info) {
-            Eina_List *list = (Eina_List*)(window_context->etc_info);
-            Eina_List *iter = NULL;
-            Eina_List *iter_next = NULL;
-            void *data = NULL;
+        if (window_context) {
+            utils->log("WinEfl_destroywin %p %p (basewin %p mag %p)\n", window,
+                (!(window_context->is_virtual)) ? elm_win_xwindow_get(static_cast<Evas_Object*>(window)) : 0x01,
+                windows->get_base_window(), windows->get_magnifier_window());
+            if (window_context->etc_info) {
+                Eina_List *list = (Eina_List*)(window_context->etc_info);
+                Eina_List *iter = NULL;
+                Eina_List *iter_next = NULL;
+                void *data = NULL;
 
-            EINA_LIST_FOREACH_SAFE(list, iter, iter_next, data) {
-                if (data) {
-                    EFLObject *object = (EFLObject*)(data);
-                    if (object) {
-                        Evas_Object* eo = object->object;
-                        if (object->extracted) {
-                            //evas_object_image_data_set(eo, NULL);
-                            void *image_data = evas_object_image_data_get(eo, 1);
-                            if (image_data) {
-                                free(image_data);
+                EINA_LIST_FOREACH_SAFE(list, iter, iter_next, data) {
+                    if (data) {
+                        EFLObject *object = (EFLObject*)(data);
+                        if (object) {
+                            Evas_Object* eo = object->object;
+                            if (object->extracted) {
+                                //evas_object_image_data_set(eo, NULL);
+                                void *image_data = evas_object_image_data_get(eo, 1);
+                                if (image_data) {
+                                    free(image_data);
+                                }
                             }
-                        }
-                        if (eo) {
-                            evas_object_del(eo);
-                            object->object = NULL;
-                        }
-                        if (object->type == EFLOBJECT_TEXTBLOCK) {
-                            Evas_Textblock_Style *st = (Evas_Textblock_Style*)(object->data);
-                            if (st) {
-                                evas_textblock_style_free(st);
+                            if (eo) {
+                                evas_object_del(eo);
+                                object->object = NULL;
                             }
+                            if (object->type == EFLOBJECT_TEXTBLOCK) {
+                                Evas_Textblock_Style *st = (Evas_Textblock_Style*)(object->data);
+                                if (st) {
+                                    evas_textblock_style_free(st);
+                                }
 #ifdef TEST_NEWBACKEND
-                            for(sclint loop = 0;loop < g_TextCache.size();loop++) {
-                                if (g_TextCache[loop].text == object->object) {
-                                    g_TextCache[loop].used = FALSE;
+                                for(sclint loop = 0;loop < g_TextCache.size();loop++) {
+                                    if (g_TextCache[loop].text == object->object) {
+                                        g_TextCache[loop].used = FALSE;
+                                    }
                                 }
-                            }
 #endif
-                        } else if (object->type == EFLOBJECT_IMAGE) {
+                            } else if (object->type == EFLOBJECT_IMAGE) {
 #ifdef TEST_NEWBACKEND
-                            for(sclint loop = 0;loop < g_ImageCache.size();loop++) {
-                                if (g_ImageCache[loop].image == object->object) {
-                                    g_ImageCache[loop].used = FALSE;
+                                for(sclint loop = 0;loop < g_ImageCache.size();loop++) {
+                                    if (g_ImageCache[loop].image == object->object) {
+                                        g_ImageCache[loop].used = FALSE;
+                                    }
                                 }
-                            }
 #endif
+                            }
+                            delete object;
                         }
-                        delete object;
                     }
+                    list = eina_list_remove_list(list, iter);
                 }
-                list = eina_list_remove_list(list, iter);
+                window_context->etc_info = NULL;
             }
-            window_context->etc_info = NULL;
-        }
 
-        if (!(window_context->is_virtual)) {
-            /* FIXME : A workaround for the bug that event on a window being hidden is delivered to
-                e17, instead of the window itself or the window right below - Should report to WM */
-            if (window == windows->get_nth_popup_window(SCL_WINDOW_Z_TOP)) {
-                ecore_timer_add(0.1f, destroy_later, (void*)window);
-            } else {
-                Evas_Object *win = (Evas_Object*)window;
-                evas_object_hide(win);
-                evas_object_del(win);
+            if (!(window_context->is_virtual)) {
+                /* FIXME : A workaround for the bug that event on a window being hidden is delivered to
+                    e17, instead of the window itself or the window right below - Should report to WM */
+                if (window == windows->get_nth_popup_window(SCL_WINDOW_Z_TOP)) {
+                    ecore_timer_add(0.1f, destroy_later, (void*)window);
+                } else {
+                    Evas_Object *win = (Evas_Object*)window;
+                    evas_object_hide(win);
+                    evas_object_del(win);
+                }
             }
+            utils->log("WinEfl_destroywin %p %p (basewin %p mag %p)\n", window,
+                (window_context && !(window_context->is_virtual)) ? elm_win_xwindow_get(static_cast<Evas_Object*>(window)) : 0x01,
+                windows->get_base_window(), windows->get_magnifier_window());
         }
-        utils->log("WinEfl_destroywin %p %p (basewin %p mag %p)\n",
-            window,
-            (window_context && !(window_context->is_virtual)) ? elm_win_xwindow_get(static_cast<Evas_Object*>(window)) : 0x01,
-            windows->get_base_window(), windows->get_magnifier_window());
     }
 
     return TRUE;
index 4471034..0effd3d 100644 (file)
@@ -3282,6 +3282,9 @@ CSCLController::timer_event(const scl32 data)
     scl16 id = SCL_LOWORD(data); /* Timer ID */
     scl16 value = SCL_HIWORD(data); /* event unique ID */
 
+    if (!windows || !context || !events || !state || !cache || !handler)
+        return FALSE;
+
     switch (id) {
     case SCL_TIMER_AUTOPOPUP: {
         /* Checks whether my event id is availble */
@@ -3314,7 +3317,7 @@ CSCLController::timer_event(const scl32 data)
             if (button_context) {
                 if (button_context->state == BUTTON_STATE_PRESSED) {
                     button_context->state = BUTTON_STATE_NORMAL;
-                    if (windows && coordinate) {
+                    if (coordinate) {
                         windows->update_window(window, coordinate->x, coordinate->y, coordinate->width, coordinate->height);
                     }
                 }
@@ -3363,7 +3366,7 @@ CSCLController::timer_event(const scl32 data)
             }
             //printf("AUTOPOPUP : %d %d\n", moving_point.x, moving_point.y);
 
-            if (windows && coordinate) {
+            if (coordinate) {
                 windows->update_window(window, coordinate->x, coordinate->y, coordinate->width, coordinate->height);
             }
         }
@@ -3490,7 +3493,7 @@ CSCLController::timer_event(const scl32 data)
         desc.timed_out = TRUE;
 
         SclResParserManager *sclres_manager = SclResParserManager::get_instance();
-        if (windows && sclres_manager) {
+        if (sclres_manager) {
             const PSclInputModeConfigure sclres_input_mode_configure =
                 sclres_manager->get_input_mode_configure_table();
             sclwindow window = windows->get_nth_popup_window(SCL_WINDOW_Z_TOP);
index d272eab..7d4c2ba 100644 (file)
@@ -103,8 +103,8 @@ static void handle_shift_state_on_button_click_event(SclUIEventDesc ui_event_des
         turn_shift_off = FALSE;
     }
     /* If we are in ON_PRESSED or ON_KEY_ENTERED mode of shift multi touch state, do not turn it off now */
-    if (context->get_shift_multi_touch_enabled() && turn_shift_off) {
-        if (context) {
+    if (context) {
+        if (context->get_shift_multi_touch_enabled() && turn_shift_off) {
             if (context->get_shift_multi_touch_state() == SCL_SHIFT_MULTITOUCH_ON_PRESSED) {
                 context->set_shift_multi_touch_state(SCL_SHIFT_MULTITOUCH_ON_KEY_ENTERED);
                 turn_shift_off = FALSE;
index 8fcf081..f8eea3d 100644 (file)
@@ -109,7 +109,8 @@ parsing_field(const xmlNodePtr node, MetaData_Field& data, const MetaData_Width&
     xmlChar* name = xmlGetProp(node, (const xmlChar*)"name");
     if (name == NULL) return -1;
     /*FIXME strncpy ?*/
-    strcpy(data.m_name, (const char*)name);
+    strncpy(data.m_name, (const char*)name, sizeof(data.m_name));
+    data.m_name[sizeof(data.m_name)-1] = '\0';
     xmlFree(name);
 
     xmlChar* type = xmlGetProp(node, (const xmlChar*)"type");
@@ -118,25 +119,28 @@ parsing_field(const xmlNodePtr node, MetaData_Field& data, const MetaData_Width&
     int ret = 0;
     if (0 == xmlStrcmp(type, (const xmlChar*)"string_id")) {
         /*FIXME use vaule instead string*/
-        strcpy(data.m_type, (const char*)type);
+        strncpy(data.m_type, (const char*)type, sizeof(data.m_type));
+        data.m_type[sizeof(data.m_type) - 1] = '\0';
         data.m_width = metadataWidth.string_id_width;
     } else if ( 0 == xmlStrcmp(type, (const xmlChar*)"int8")) {
-        strcpy(data.m_type, (const char*)type);
+        strncpy(data.m_type, (const char*)type, sizeof(data.m_type));
+        data.m_type[sizeof(data.m_type) - 1] = '\0';
         data.m_width = 1;
-
     } else if ( 0 == xmlStrcmp(type, (const xmlChar*)"int16")) {
-        strcpy(data.m_type, (const char*)type);
+        strncpy(data.m_type, (const char*)type, sizeof(data.m_type));
+        data.m_type[sizeof(data.m_type) - 1] = '\0';
         data.m_width = 2;
-
     } else if ( 0 == xmlStrcmp(type, (const xmlChar*)"int32")) {
-        strcpy(data.m_type, (const char*)type);
+        strncpy(data.m_type, (const char*)type, sizeof(data.m_type));
+        data.m_type[sizeof(data.m_type) - 1] = '\0';
         data.m_width = 4;
-
     } else if ( 0 == xmlStrcmp(type, (const xmlChar*)"float32")) {
-        strcpy(data.m_type, (const char*)type);
+        strncpy(data.m_type, (const char*)type, sizeof(data.m_type));
+        data.m_type[sizeof(data.m_type) - 1] = '\0';
         data.m_width = 4;
     } else if ( 0 == xmlStrcmp(type, (const xmlChar*)"float64")) {
-        strcpy(data.m_type, (const char*)type);
+        strncpy(data.m_type, (const char*)type, sizeof(data.m_type));
+        data.m_type[sizeof(data.m_type) - 1] = '\0';
         data.m_width = 8;
     }
     else{
@@ -153,7 +157,8 @@ parsing_record(const xmlNodePtr curNode, MetaData_Record& metadataRecord, const
     //parsing struct name
     xmlChar* name = xmlGetProp(curNode, (const xmlChar*)"name");
     if (name == NULL) return -1;
-    strcpy(metadataRecord.m_name, (const char*)name);
+    strncpy(metadataRecord.m_name, (const char*)name, sizeof(metadataRecord.m_name));
+    metadataRecord.m_name[sizeof(metadataRecord.m_name)-1] = '\0';
     xmlFree(name);
 
     xmlNodePtr childNode = curNode->xmlChildrenNode;
@@ -227,7 +232,8 @@ parsing_metadata() {
 
     xmlChar* version = xmlGetProp(curNode, (const xmlChar*)"version");
     if (version) {
-        strcpy(metadata.m_version, (const char*)version);
+        strncpy(metadata.m_version, (const char*)version, sizeof(metadata.m_version));
+        metadata.m_version[sizeof(metadata.m_version)-1] = '\0';
         xmlFree(version);
     } else {
         strcpy(metadata.m_version, (const char*)"");