From 346b1212862b0f339185c8fcc1f98d833e9f287e Mon Sep 17 00:00:00 2001 From: SangYong Park Date: Tue, 28 May 2013 10:01:00 +0900 Subject: [PATCH] Add null checking in InputMethodContextEFL [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 | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Source/WebKit2/UIProcess/efl/InputMethodContextEfl.cpp b/Source/WebKit2/UIProcess/efl/InputMethodContextEfl.cpp index c6902c9..bde3a43 100755 --- a/Source/WebKit2/UIProcess/efl/InputMethodContextEfl.cpp +++ b/Source/WebKit2/UIProcess/efl/InputMethodContextEfl.cpp @@ -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(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(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(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; -- 2.7.4