Add null checking in InputMethodContextEFL
authorSangYong Park <sy302.park@samsung.com>
Tue, 28 May 2013 01:01:00 +0000 (10:01 +0900)
committerSangYong Park <sy302.park@samsung.com>
Wed, 5 Jun 2013 03:08:01 +0000 (12:08 +0900)
[Title] Add null checking in InputMethodContextEFL
[Issue#] N_SE-40282
[Problem] abort() was occured in ecore imf module
[Cause] null pointer was passed
[Solution] Add null checking in InputMethodContextEFL

Change-Id: I5bb3be43f954700a93e3f9e8077a6d7c2419f2f5

Source/WebKit2/UIProcess/efl/InputMethodContextEfl.cpp

index c6902c9..bde3a43 100755 (executable)
@@ -73,9 +73,11 @@ void InputMethodContextEfl::onIMFInputPanelStateChanged(void* data, Ecore_IMF_Co
         evas_object_smart_callback_call(inputMethodContext->m_viewImpl->view(), "editorclient,ime,opened", 0);
 }
 
-void InputMethodContextEfl::onIMFInputPanelGeometryChanged(void* data, Ecore_IMF_Context*, int value)
+void InputMethodContextEfl::onIMFInputPanelGeometryChanged(void* data, Ecore_IMF_Context*, int)
 {
     InputMethodContextEfl* inputMethodContext = static_cast<InputMethodContextEfl*>(data);
+    if (!inputMethodContext->m_context)
+        return;
 
     Eina_Rectangle rect;
     ecore_imf_context_input_panel_geometry_get(inputMethodContext->m_context.get(), &rect.x, &rect.y, &rect.w, &rect.h);
@@ -97,6 +99,8 @@ void InputMethodContextEfl::onIMFCandidatePanelStateChanged(void* data, Ecore_IM
 void InputMethodContextEfl::onIMFCandidatePanelGeometryChanged(void* data, Ecore_IMF_Context*, int)
 {
     InputMethodContextEfl* inputMethodContext = static_cast<InputMethodContextEfl*>(data);
+    if (!inputMethodContext->m_context)
+        return;
 
     Eina_Rectangle rect;
     ecore_imf_context_candidate_panel_geometry_get(inputMethodContext->m_context.get(), &rect.x, &rect.y, &rect.w, &rect.h);
@@ -318,6 +322,11 @@ void InputMethodContextEfl::handleMouseUpEvent(const Evas_Event_Mouse_Up*)
 
 void InputMethodContextEfl::handleKeyDownEvent(const Evas_Event_Key_Down* downEvent, bool* isFiltered)
 {
+#if ENABLE(TIZEN_ISF_PORT)
+    if (!m_context)
+        return;
+#endif
+
     Ecore_IMF_Event inputMethodEvent;
     ecore_imf_evas_event_key_down_wrap(const_cast<Evas_Event_Key_Down*>(downEvent), &inputMethodEvent.key_down);
 
@@ -447,12 +456,15 @@ void InputMethodContextEfl::setIMFContext(const EditorState& editor)
     else
         context = takeContext(editor.inputMethodContextID);
 
+    revertIMFContext();
+
     if (!context) {
         context = createIMFContext(evas_object_evas_get(m_viewImpl->view()));
+        if (!context)
+            return;
         initializeIMFContext(context.get(), layout, layoutVariation, returnKeyType);
     }
 
-    revertIMFContext();
     m_context = context.release();
     m_contextID = editor.inputMethodContextID;
 
@@ -591,6 +603,8 @@ void InputMethodContextEfl::showIMFContext(const EditorState& editor)
     }
 
     setIMFContext(editor);
+    if (!m_context)
+        return;
 
     if (!hasFocus) {
         m_focused = true;