summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMyoungwoon Roy, Kim <myoungwoon.kim@samsung.com>2018-01-31 18:53:09 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2018-01-31 18:55:40 +0900
commit211093b7c52361f38fd0fa089ebb0c3d6fd1afe6 (patch)
tree0a08af949987ddb2806619f6512c3fd20af831a5
parente9d1a1e9884331aca633e32f2592739a224dfdb2 (diff)
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
-rw-r--r--src/lib/ecore/ecore_events.c8
-rw-r--r--src/tests/ecore/ecore_test_ecore.c5
2 files changed, 11 insertions, 2 deletions
diff --git a/src/lib/ecore/ecore_events.c b/src/lib/ecore/ecore_events.c
index de0f16dfb7..8d0b878803 100644
--- a/src/lib/ecore/ecore_events.c
+++ b/src/lib/ecore/ecore_events.c
@@ -73,10 +73,14 @@ ecore_event_add(int type,
73 void *data) 73 void *data)
74{ 74{
75 Ecore_Event_Message *msg; 75 Ecore_Event_Message *msg;
76 if (type <= ECORE_EVENT_NONE) return NULL;
76 77
77 msg = ecore_event_message_handler_message_type_add(_event_msg_handler); 78 msg = ecore_event_message_handler_message_type_add(_event_msg_handler);
78 ecore_event_message_data_set(msg, type, ev, func_free, data); 79 if (msg)
79 efl_loop_message_handler_message_send(_event_msg_handler, msg); 80 {
81 ecore_event_message_data_set(msg, type, ev, func_free, data);
82 efl_loop_message_handler_message_send(_event_msg_handler, msg);
83 }
80 return (Ecore_Event *)msg; 84 return (Ecore_Event *)msg;
81} 85}
82 86
diff --git a/src/tests/ecore/ecore_test_ecore.c b/src/tests/ecore/ecore_test_ecore.c
index 3fd89a90b1..492c2aa033 100644
--- a/src/tests/ecore/ecore_test_ecore.c
+++ b/src/tests/ecore/ecore_test_ecore.c
@@ -531,6 +531,7 @@ START_TEST(ecore_test_ecore_main_loop_event)
531 Ecore_Event_Handler *handler, *handler2, *handler3; 531 Ecore_Event_Handler *handler, *handler2, *handler3;
532 Ecore_Event_Filter *filter_handler; 532 Ecore_Event_Filter *filter_handler;
533 Ecore_Event *event; 533 Ecore_Event *event;
534 Ecore_Event *event2;
534 int res_counter; 535 int res_counter;
535 int type, type2; 536 int type, type2;
536 int *ev = NULL; 537 int *ev = NULL;
@@ -574,6 +575,10 @@ START_TEST(ecore_test_ecore_main_loop_event)
574 event = ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, NULL, NULL, NULL); 575 event = ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, NULL, NULL, NULL);
575 fail_if(event == NULL); 576 fail_if(event == NULL);
576 577
578 /* Add one more events: to check a type */
579 event2 = ecore_event_add(ECORE_EVENT_NONE, NULL, NULL, NULL);
580 fail_if(event2 != NULL);
581
577 ecore_main_loop_begin(); 582 ecore_main_loop_begin();
578 583
579 /* 584 /*