Avoid duplicate fd_read requests to prevent broken pipe error 06/140306/3
authorInHong Han <inhong1.han@samsung.com>
Mon, 24 Jul 2017 08:39:48 +0000 (17:39 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Wed, 26 Jul 2017 00:14:08 +0000 (00:14 +0000)
Change-Id: I5bcec8a95bc6c1b64db4b981b9d2b718f9071561

ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp

index 2d192c7..ca2b468 100644 (file)
@@ -2045,9 +2045,13 @@ remote_surrounding_text_fd_read_func (void* data, Ecore_Fd_Handler* fd_handler)
 static void
 remote_surrounding_get (WSCContextISF *wsc_ctx)
 {
+    if (wsc_ctx && wsc_ctx->im_ctx && wsc_ctx->remote_surrounding_text_fd_read_handler)
+        return;
+
     int filedes[2];
     if (pipe2(filedes, O_CLOEXEC | O_NONBLOCK) == -1) {
         LOGW ("create pipe failed");
+        return;
     } else {
         LOGD("%d,%d", filedes[0], filedes[1]);
         if (wsc_ctx && wsc_ctx->im_ctx) {
@@ -2057,13 +2061,6 @@ remote_surrounding_get (WSCContextISF *wsc_ctx)
         close (filedes[1]);
 
         if (wsc_ctx && wsc_ctx->im_ctx) {
-            if (wsc_ctx->remote_surrounding_text_fd_read_handler) {
-                int fd = ecore_main_fd_handler_fd_get (wsc_ctx->remote_surrounding_text_fd_read_handler);
-                close (fd);
-                ecore_main_fd_handler_del (wsc_ctx->remote_surrounding_text_fd_read_handler);
-                wsc_ctx->remote_surrounding_text_fd_read_handler = NULL;
-            }
-
             if (wsc_ctx->remote_surrounding_text) {
                 free (wsc_ctx->remote_surrounding_text);
                 wsc_ctx->remote_surrounding_text = NULL;