ecore_pipe: remove null check condition and fix segfualt on Windows
Summary: This reverts commit4917910b49
.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 after4917910b
. 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
This commit is contained in:
parent
cbe9b6f770
commit
15cc9a65aa
|
@ -286,6 +286,7 @@ tests/ecore/ecore_test_ecore_input.c \
|
||||||
tests/ecore/ecore_test_ecore_file.c \
|
tests/ecore/ecore_test_ecore_file.c \
|
||||||
tests/ecore/ecore_test_job.c \
|
tests/ecore/ecore_test_job.c \
|
||||||
tests/ecore/ecore_test_args.c \
|
tests/ecore/ecore_test_args.c \
|
||||||
|
tests/ecore/ecore_test_pipe.c \
|
||||||
tests/ecore/ecore_suite.h
|
tests/ecore/ecore_suite.h
|
||||||
|
|
||||||
tests_ecore_ecore_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
|
tests_ecore_ecore_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
|
||||||
|
|
|
@ -591,11 +591,6 @@ _ecore_pipe_handler_call(Ecore_Pipe *p,
|
||||||
unsigned char *buf,
|
unsigned char *buf,
|
||||||
size_t len)
|
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;
|
void *data = (void*) p->data;
|
||||||
|
|
||||||
// clear all values of pipe first.
|
// clear all values of pipe first.
|
||||||
|
|
|
@ -66,7 +66,7 @@ static void _evas_async_events_fd_blocking_set(Eina_Bool blocking EINA_UNUSED);
|
||||||
static void
|
static void
|
||||||
_async_events_pipe_read_cb(void *data EINA_UNUSED, void *buf, unsigned int len)
|
_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;
|
return;
|
||||||
|
|
||||||
Evas_Event_Async *ev;
|
Evas_Event_Async *ev;
|
||||||
|
|
|
@ -29,6 +29,7 @@ static const Efl_Test_Case etc[] = {
|
||||||
{ "Ecore_File", ecore_test_ecore_file },
|
{ "Ecore_File", ecore_test_ecore_file },
|
||||||
{ "Ecore_Job", ecore_test_ecore_job },
|
{ "Ecore_Job", ecore_test_ecore_job },
|
||||||
{ "Ecore_Args", ecore_test_ecore_args },
|
{ "Ecore_Args", ecore_test_ecore_args },
|
||||||
|
{ "Ecore_Pipe", ecore_test_ecore_pipe },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -22,5 +22,6 @@ void ecore_test_ecore_input(TCase *tc);
|
||||||
void ecore_test_ecore_file(TCase *tc);
|
void ecore_test_ecore_file(TCase *tc);
|
||||||
void ecore_test_ecore_job(TCase *tc);
|
void ecore_test_ecore_job(TCase *tc);
|
||||||
void ecore_test_ecore_args(TCase *tc);
|
void ecore_test_ecore_args(TCase *tc);
|
||||||
|
void ecore_test_ecore_pipe(TCase *tc);
|
||||||
|
|
||||||
#endif /* _ECORE_SUITE_H */
|
#endif /* _ECORE_SUITE_H */
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
Loading…
Reference in New Issue