ecore_event: Check for the valid type

Summary:
This patch checks for the valid types.
As mentioned API reference documentation, user must know its type before hand.
The type should be chedked like previous efl version and ecore_event_type_flush_internal()

Test Plan: Execute a ecore test suite.

Reviewers: cedric, raster, jpeg, stefan_schmidt, Jaehyun_Cho

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D5776
This commit is contained in:
Myoungwoon Roy, Kim 2018-01-31 18:53:09 +09:00 committed by Jean-Philippe Andre
parent e9d1a1e988
commit 211093b7c5
2 changed files with 11 additions and 2 deletions

View File

@ -73,10 +73,14 @@ ecore_event_add(int type,
void *data)
{
Ecore_Event_Message *msg;
if (type <= ECORE_EVENT_NONE) return NULL;
msg = ecore_event_message_handler_message_type_add(_event_msg_handler);
ecore_event_message_data_set(msg, type, ev, func_free, data);
efl_loop_message_handler_message_send(_event_msg_handler, msg);
if (msg)
{
ecore_event_message_data_set(msg, type, ev, func_free, data);
efl_loop_message_handler_message_send(_event_msg_handler, msg);
}
return (Ecore_Event *)msg;
}

View File

@ -531,6 +531,7 @@ START_TEST(ecore_test_ecore_main_loop_event)
Ecore_Event_Handler *handler, *handler2, *handler3;
Ecore_Event_Filter *filter_handler;
Ecore_Event *event;
Ecore_Event *event2;
int res_counter;
int type, type2;
int *ev = NULL;
@ -574,6 +575,10 @@ START_TEST(ecore_test_ecore_main_loop_event)
event = ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, NULL, NULL, NULL);
fail_if(event == NULL);
/* Add one more events: to check a type */
event2 = ecore_event_add(ECORE_EVENT_NONE, NULL, NULL, NULL);
fail_if(event2 != NULL);
ecore_main_loop_begin();
/*