aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYeongjong Lee <yj34.lee@samsung.com>2018-08-17 12:42:35 -0400
committerMike Blumenkrantz <zmike@samsung.com>2018-08-17 12:42:35 -0400
commit15cc9a65aa8656d4183b9eada790143363c7dc06 (patch)
treeb20f79864bec445203d5fab5f6dbfd8effba348d
parenteina_file: check copied using copied (diff)
downloadefl-15cc9a65aa8656d4183b9eada790143363c7dc06.tar.gz
ecore_pipe: remove null check condition and fix segfualt on Windows
Summary: This reverts commit 4917910b4911905236fa099bbc16b833b056ca07. 4917910b break backward compatibility. Reproduction: void pipe_handler(...); pipe = ecore_pipe_add(pipe_handler, NULL); ecore_pipe_write(pipe, NULL, 0); Because of the null check condition, pipe_handler isn't called after 4917910b. Some apps behavior which is written to expected to call pipe_handler was broken. also, this patch fixed segfault during build on Windows Test Plan: make on Windows Reviewers: raster, zmike, vtorri Reviewed By: zmike, vtorri Subscribers: woohyun, cedric, #reviewers, #committers, zmike, vtorri Tags: #efl Differential Revision: https://phab.enlightenment.org/D6824
-rw-r--r--src/Makefile_Ecore.am1
-rw-r--r--src/lib/ecore/ecore_pipe.c5
-rw-r--r--src/lib/evas/canvas/evas_async_events.c2
-rw-r--r--src/tests/ecore/ecore_suite.c1
-rw-r--r--src/tests/ecore/ecore_suite.h1
-rw-r--r--src/tests/ecore/ecore_test_pipe.c41
6 files changed, 45 insertions, 6 deletions
diff --git a/src/Makefile_Ecore.am b/src/Makefile_Ecore.am
index 8c724fa636..b71652738e 100644
--- a/src/Makefile_Ecore.am
+++ b/src/Makefile_Ecore.am
@@ -286,6 +286,7 @@ tests/ecore/ecore_test_ecore_input.c \
tests/ecore/ecore_test_ecore_file.c \
tests/ecore/ecore_test_job.c \
tests/ecore/ecore_test_args.c \
+tests/ecore/ecore_test_pipe.c \
tests/ecore/ecore_suite.h
tests_ecore_ecore_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
diff --git a/src/lib/ecore/ecore_pipe.c b/src/lib/ecore/ecore_pipe.c
index f9aa62655a..92127b95d0 100644
--- a/src/lib/ecore/ecore_pipe.c
+++ b/src/lib/ecore/ecore_pipe.c
@@ -591,11 +591,6 @@ _ecore_pipe_handler_call(Ecore_Pipe *p,
unsigned char *buf,
size_t len)
{
- // on windows we seem to get a pipe wake with no data. don't pass on
- // zero data as there is nothing useful to do with it... and it causes
- // segfaults
- if ((!buf) || (!len)) return;
-
void *data = (void*) p->data;
// clear all values of pipe first.
diff --git a/src/lib/evas/canvas/evas_async_events.c b/src/lib/evas/canvas/evas_async_events.c
index b7141a54e4..c27c23b459 100644
--- a/src/lib/evas/canvas/evas_async_events.c
+++ b/src/lib/evas/canvas/evas_async_events.c
@@ -66,7 +66,7 @@ static void _evas_async_events_fd_blocking_set(Eina_Bool blocking EINA_UNUSED);
static void
_async_events_pipe_read_cb(void *data EINA_UNUSED, void *buf, unsigned int len)
{
- if (wakeup != *(int*)buf || sizeof(int) != len)
+ if (!buf || wakeup != *(int*)buf || sizeof(int) != len)
return;
Evas_Event_Async *ev;
diff --git a/src/tests/ecore/ecore_suite.c b/src/tests/ecore/ecore_suite.c
index 9e6baf6abb..53c6bbb3bf 100644
--- a/src/tests/ecore/ecore_suite.c
+++ b/src/tests/ecore/ecore_suite.c
@@ -29,6 +29,7 @@ static const Efl_Test_Case etc[] = {
{ "Ecore_File", ecore_test_ecore_file },
{ "Ecore_Job", ecore_test_ecore_job },
{ "Ecore_Args", ecore_test_ecore_args },
+ { "Ecore_Pipe", ecore_test_ecore_pipe },
{ NULL, NULL }
};
diff --git a/src/tests/ecore/ecore_suite.h b/src/tests/ecore/ecore_suite.h
index d1a698ea99..a3327412fe 100644
--- a/src/tests/ecore/ecore_suite.h
+++ b/src/tests/ecore/ecore_suite.h
@@ -22,5 +22,6 @@ void ecore_test_ecore_input(TCase *tc);
void ecore_test_ecore_file(TCase *tc);
void ecore_test_ecore_job(TCase *tc);
void ecore_test_ecore_args(TCase *tc);
+void ecore_test_ecore_pipe(TCase *tc);
#endif /* _ECORE_SUITE_H */
diff --git a/src/tests/ecore/ecore_test_pipe.c b/src/tests/ecore/ecore_test_pipe.c
new file mode 100644
index 0000000000..e4b7b9bc0c
--- /dev/null
+++ b/src/tests/ecore/ecore_test_pipe.c
@@ -0,0 +1,41 @@
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <Ecore.h>
+#include "ecore_suite.h"
+
+static void
+_pipe_handler(void *data, void *buf EINA_UNUSED, unsigned int len EINA_UNUSED)
+{
+ Eina_Bool *bob = data;
+
+ *bob = EINA_TRUE;
+ ecore_main_loop_quit();
+}
+
+EFL_START_TEST(ecore_test_pipe)
+{
+ Ecore_Pipe *pipe;
+ Eina_Bool bob = EINA_FALSE;
+
+ pipe = ecore_pipe_add(_pipe_handler, &bob);
+ fail_if(!pipe);
+
+ ecore_pipe_write(pipe, &bob, sizeof(Eina_Bool));
+ ecore_main_loop_begin();
+ ck_assert_int_eq(bob, EINA_TRUE);
+
+ bob = EINA_FALSE;
+ ecore_pipe_write(pipe, NULL, 0);
+ ecore_main_loop_begin();
+ ck_assert_int_eq(bob, EINA_TRUE);
+
+ ecore_pipe_del(pipe);
+}
+EFL_END_TEST
+
+void ecore_test_ecore_pipe(TCase *tc)
+{
+ tcase_add_test(tc, ecore_test_pipe);
+}