Fix crash issue after input context is deleted 86/212686/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Mon, 26 Aug 2019 05:52:20 +0000 (14:52 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Mon, 26 Aug 2019 05:52:24 +0000 (14:52 +0900)
After input context requested to show is deleted, ecore_imf_context_input_panel_event_callback_call() in _conformant_change_cb() has invalid context parameter.

Change-Id: Ibd615e221c922a2816a0f8b384f1fc8041c4cbf0
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
ism/extras/wayland_immodule/wayland_imcontext.c

index 5c2fa9b..c2f33a0 100644 (file)
@@ -1601,8 +1601,7 @@ static void _render_post_cb(void *data, Evas *e, void *event_info)
 static Eina_Bool _conformant_change_cb(void *data, int ev_type, void *ev)
 {
     Ecore_Wl2_Event_Conformant_Change *e = (Ecore_Wl2_Event_Conformant_Change *)ev;
-    Ecore_IMF_Context *ctx = (Ecore_IMF_Context *)data;
-    if (!e || !ctx) return ECORE_CALLBACK_PASS_ON;
+    if (!e) return ECORE_CALLBACK_PASS_ON;
 
     LOGD ("CONFORMANT changed!! part type : %d, state : %d, win : %d", e->part_type, e->state, e->win);
 
@@ -1620,7 +1619,7 @@ static Eina_Bool _conformant_change_cb(void *data, int ev_type, void *ev)
         _conformant_reset_done = EINA_FALSE;
         if (_active_context_canvas && ecore_wl2_window_conformant_get(window) && !_custom_conformant_event) {
             evas_event_callback_del(_active_context_canvas, EVAS_CALLBACK_RENDER_POST, _render_post_cb);
-            evas_event_callback_add(_active_context_canvas, EVAS_CALLBACK_RENDER_POST, _render_post_cb, ctx);
+            evas_event_callback_add(_active_context_canvas, EVAS_CALLBACK_RENDER_POST, _render_post_cb, NULL);
         }
     } else {
         _conformant_reset_done = EINA_FALSE;
@@ -1678,7 +1677,9 @@ static Eina_Bool _conformant_change_cb(void *data, int ev_type, void *ev)
             }
             LOGD("[KEYPAD]: scr %dx%d, rot %d, orig (%d,%d, %dx%d)", scr_w, scr_h, rot, x, y, w, h);
             LOGD ("IME geometry x : %d, y : %d, w : %d, h : %d", _keyboard_geometry.x, _keyboard_geometry.y, _keyboard_geometry.w, _keyboard_geometry.h);
-            ecore_imf_context_input_panel_event_callback_call(ctx, ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, 0);
+
+            if (_show_req_ctx)
+                ecore_imf_context_input_panel_event_callback_call(_show_req_ctx, ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, 0);
         }
     }
 
@@ -1780,7 +1781,7 @@ show_input_panel(Ecore_IMF_Context *ctx)
 
     _win_focus_out_handler = ecore_event_handler_add (ECORE_WL2_EVENT_FOCUS_OUT, _client_window_focus_out_cb, ctx);
     _conformant_change_handler_del ();
-    _conformant_change_handler = ecore_event_handler_add(ECORE_WL2_EVENT_CONFORMANT_CHANGE, _conformant_change_cb, ctx);
+    _conformant_change_handler = ecore_event_handler_add(ECORE_WL2_EVENT_CONFORMANT_CHANGE, _conformant_change_cb, NULL);
 
     // TIZEN_ONLY(20160217): ignore the duplicate show request
     if ((_show_req_ctx == ctx) && _compare_context(_show_req_ctx, ctx) && (!will_hide)) {