Fixed the deadlock issue during the wl_interface. 72/111072/1
authorWonkeun Oh <wonkeun.oh@samsung.com>
Thu, 19 Jan 2017 09:38:23 +0000 (18:38 +0900)
committerWonkeun Oh <wonkeun.oh@samsung.com>
Thu, 19 Jan 2017 09:46:00 +0000 (18:46 +0900)
Do not send the filter_key_event if there is no _focused_ctx

Change-Id: I4934af371222155edfe51284d25185ece633844a

ism/extras/wayland_immodule/wayland_imcontext.c

index 399e453c6a93cd19e45bf3d18189388f5703f6c7..6824950b994d4b03cd61a1b508de26866ef98b13 100644 (file)
@@ -1214,34 +1214,36 @@ commit_preedit(WaylandIMContext *imcontext)
     }
 }
 
-static void
+static Eina_Bool
 set_focus(Ecore_IMF_Context *ctx)
 {
     LOGD("");
     WaylandIMContext *imcontext = (WaylandIMContext *)ecore_imf_context_data_get(ctx);
-    if (!imcontext) return;
+    if (!imcontext) return EINA_FALSE;
 
     if (!imcontext->window) {
         LOGW("window is not given\n");
-        return;
+        return EINA_FALSE;
     }
 
     Ecore_Wl_Input *input = ecore_wl_window_keyboard_get(imcontext->window);
     if (!input) {
         LOGW("Can't get Wl_Input\n");
-        return;
+        return EINA_FALSE;
     }
 
     struct wl_seat *seat = ecore_wl_input_seat_get(input);
     if (!seat) {
         LOGW("Can't get Wl_seat\n");
-        return;
+        return EINA_FALSE;
     }
 
     imcontext->input = input;
 
     wl_text_input_activate(imcontext->text_input, seat,
             ecore_wl_window_surface_get(imcontext->window));
+
+    return EINA_TRUE;
 }
 
 static void
@@ -2465,7 +2467,11 @@ wayland_im_context_focus_in(Ecore_IMF_Context *ctx)
     _focused_ctx = ctx;
     //
 
-    set_focus(ctx);
+    if (!set_focus(ctx)) {
+        _focused_ctx = NULL;
+        LOGW("Fail to set focus!");
+        return;
+    }
 
     LOGD ("ctx : %p. on demand : %d\n", ctx, ecore_imf_context_input_panel_show_on_demand_get (ctx));