Fixed the deadlock issue. 10/116410/1
authorWonkeun Oh <wonkeun.oh@samsung.com>
Fri, 24 Feb 2017 01:36:27 +0000 (10:36 +0900)
committerWonkeun Oh <wonkeun.oh@samsung.com>
Fri, 24 Feb 2017 07:33:55 +0000 (16:33 +0900)
If the default event queue is empty, the 'wl_display_dispatch' function blocks until there are events to be read from the display fd.
So, it might cause the deadlock state of the application's process, If the event queue is empty continually because of some problem.

As for the 'wl_display_roundtrip' function,
This function blocks until the server has processed all currently issued requests by sending a request to the display server and waiting for a reply before returning.

Plus, these functions return the -1 on failure such as closed connection case. It need to be checked

Change-Id: If1e007196945422433d66bf47de58f1809f0535d

ism/extras/wayland_immodule/wayland_imcontext.c

index 15cbe68..a7c6a13 100644 (file)
@@ -2953,9 +2953,7 @@ wayland_im_context_filter_event(Ecore_IMF_Context    *ctx,
             //This function should return IME filtering result with boolean type.
             struct wl_display *display = ecore_wl_display_get();
             if (display) {
-                while (ecore_time_get() - start_time < WAIT_FOR_FILTER_DONE_SECOND) {
-                    wl_display_dispatch(display);
-
+                while (ecore_time_get() - start_time < WAIT_FOR_FILTER_DONE_SECOND && wl_display_roundtrip(display) != -1) {
                     if (imcontext->last_key_event_filter.serial == serial) {
                         ret = imcontext->last_key_event_filter.state;
                         break;