From 06593d435814d31545f6ac91a6ae35d419b6d39a Mon Sep 17 00:00:00 2001 From: InHong Han Date: Mon, 24 Jul 2017 17:39:48 +0900 Subject: [PATCH] Avoid duplicate fd_read requests to prevent broken pipe error Change-Id: I5bcec8a95bc6c1b64db4b981b9d2b718f9071561 --- ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp b/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp index 2d192c7..ca2b468 100644 --- a/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp +++ b/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp @@ -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; -- 2.7.4