2016-11-29 11:18:44 -08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <Eo.h>
|
|
|
|
|
|
|
|
#include "eo_suite.h"
|
|
|
|
#include "eo_test_class_simple.h"
|
|
|
|
|
|
|
|
//Class definition with one event
|
|
|
|
|
eo: Rename EAPI macro to EO_API in Eo library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
= The Rationale =
This patch is from a series of patches to rename EAPI symbols to
specific library DSOs.
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
LIBAPI is the only solution that works for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Reviewers: jptiz, lucas, vtorri, woohyun
Reviewed By: jptiz, lucas, vtorri
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12203
2020-12-09 08:50:29 -08:00
|
|
|
EO_API_WEAK const Efl_Class *efl_test_event_class_get(void) EINA_CONST;
|
2016-11-29 11:18:44 -08:00
|
|
|
|
eo: Rename EAPI macro to EO_API in Eo library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
= The Rationale =
This patch is from a series of patches to rename EAPI symbols to
specific library DSOs.
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
LIBAPI is the only solution that works for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Reviewers: jptiz, lucas, vtorri, woohyun
Reviewed By: jptiz, lucas, vtorri
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12203
2020-12-09 08:50:29 -08:00
|
|
|
EO_API_WEAK extern const Efl_Event_Description _EFL_TEST_EVENT_EVENT_TESTER;
|
|
|
|
EO_API_WEAK extern const Efl_Event_Description _EFL_TEST_EVENT_EVENT_TESTER_SUBSCRIBE;
|
|
|
|
EO_API_WEAK extern const Efl_Event_Description _EFL_TEST_EVENT_EVENT_TESTER_CLAMP_TEST;
|
2016-11-29 11:18:44 -08:00
|
|
|
|
|
|
|
#define EFL_TEST_EVENT_EVENT_TESTER (&(_EFL_TEST_EVENT_EVENT_TESTER))
|
eo: ensure the generation is correctly clamped
Summary:
when a few recursive event emissions are happening, and in some deep
recursive level a subscription to the same object is happening, the
subscription would just be executed when the complete recursion is done.
that is wrong. The subscription needs to be executed when the event is
called after the subscription is added, undepended from any recursive
level. That fixes that and adds a regression test for it.
This was discovered in e, since e gives a lot of error messages about a eo object
that is already freed. It turned out this object is returned from evas, and exactly
the above happened to the EFL_EVENT_DEL subscription of that object.
Test Plan: make check
Reviewers: tasn, cedric, stefan_schmidt
Subscribers: stefan_schmidt, netstar, zmike, raster, jpeg
Differential Revision: https://phab.enlightenment.org/D4656
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-02-16 13:37:16 -08:00
|
|
|
#define EFL_TEST_EVENT_EVENT_TESTER_SUBSCRIBE (&(_EFL_TEST_EVENT_EVENT_TESTER_SUBSCRIBE))
|
|
|
|
#define EFL_TEST_EVENT_EVENT_TESTER_CLAMP_TEST (&(_EFL_TEST_EVENT_EVENT_TESTER_CLAMP_TEST))
|
2016-11-29 11:18:44 -08:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
Eina_Bool event1;
|
|
|
|
Eina_Bool event2;
|
|
|
|
Eina_Bool event3;
|
|
|
|
} Test_Data;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int not_empty;
|
|
|
|
} Efl_Test_Event_Data;
|
|
|
|
|
|
|
|
static void
|
2016-12-01 11:34:46 -08:00
|
|
|
_cb3(void *data, const Efl_Event *event EINA_UNUSED)
|
2016-11-29 11:18:44 -08:00
|
|
|
{
|
|
|
|
Test_Data *d = data;
|
|
|
|
|
|
|
|
d->event3 = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2016-12-01 11:34:46 -08:00
|
|
|
_cb2(void *data, const Efl_Event *event EINA_UNUSED)
|
2016-11-29 11:18:44 -08:00
|
|
|
{
|
|
|
|
Test_Data *d = data;
|
|
|
|
|
|
|
|
d->event2 = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_cb1(void *data, const Efl_Event *event)
|
|
|
|
{
|
|
|
|
Test_Data *d = data;
|
|
|
|
|
|
|
|
d->event1 = EINA_TRUE;
|
|
|
|
|
|
|
|
efl_event_callback_add(event->object, EFL_TEST_EVENT_EVENT_TESTER, _cb3, data);
|
|
|
|
}
|
|
|
|
|
2018-03-26 11:19:28 -07:00
|
|
|
EFL_START_TEST(eo_event)
|
2016-11-29 11:18:44 -08:00
|
|
|
{
|
|
|
|
Test_Data data;
|
|
|
|
Eo *obj;
|
|
|
|
|
2018-03-15 09:50:20 -07:00
|
|
|
obj = efl_add_ref(efl_test_event_class_get(), NULL);
|
2016-11-29 11:18:44 -08:00
|
|
|
efl_event_callback_priority_add(obj, EFL_TEST_EVENT_EVENT_TESTER, EFL_CALLBACK_PRIORITY_BEFORE, _cb2, &data);
|
|
|
|
efl_event_callback_priority_add(obj, EFL_TEST_EVENT_EVENT_TESTER, EFL_CALLBACK_PRIORITY_BEFORE, _cb1, &data);
|
2016-12-01 03:40:36 -08:00
|
|
|
|
|
|
|
memset(&data, 0, sizeof(Test_Data));
|
2016-11-29 11:18:44 -08:00
|
|
|
efl_event_callback_call(obj, EFL_TEST_EVENT_EVENT_TESTER, NULL);
|
2016-12-01 03:40:36 -08:00
|
|
|
ck_assert_int_ne(data.event1, 0);
|
|
|
|
ck_assert_int_ne(data.event2, 0);
|
|
|
|
ck_assert_int_eq(data.event3, 0);
|
2016-11-29 11:18:44 -08:00
|
|
|
|
2016-12-01 03:40:36 -08:00
|
|
|
memset(&data, 0, sizeof(Test_Data));
|
|
|
|
efl_event_callback_call(obj, EFL_TEST_EVENT_EVENT_TESTER, NULL);
|
2016-11-29 11:18:44 -08:00
|
|
|
ck_assert_int_ne(data.event1, 0);
|
|
|
|
ck_assert_int_ne(data.event2, 0);
|
|
|
|
ck_assert_int_ne(data.event3, 0);
|
|
|
|
|
|
|
|
}
|
2018-03-26 11:19:28 -07:00
|
|
|
EFL_END_TEST
|
2016-11-29 11:18:44 -08:00
|
|
|
|
2016-12-01 11:34:46 -08:00
|
|
|
static void
|
|
|
|
_cb_rec_3(void *data EINA_UNUSED, const Efl_Event *event)
|
|
|
|
{
|
|
|
|
Test_Data *d = event->info;
|
|
|
|
ck_assert_int_eq(d->event3, 0);
|
|
|
|
d->event3 = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_cb_rec_2(void *data EINA_UNUSED, const Efl_Event *event)
|
|
|
|
{
|
|
|
|
Test_Data *d = event->info;
|
|
|
|
ck_assert_int_eq(d->event2, 0);
|
|
|
|
d->event2 = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_cb_rec_1(void *data, const Efl_Event *event)
|
|
|
|
{
|
|
|
|
Test_Data *d = event->info;
|
|
|
|
|
|
|
|
if (event->info)
|
|
|
|
{
|
|
|
|
ck_assert_int_eq(d->event1, 0);
|
|
|
|
d->event1 = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
efl_event_callback_add(event->object , EFL_TEST_EVENT_EVENT_TESTER, _cb_rec_2, NULL);
|
|
|
|
efl_event_callback_add(event->object , EFL_TEST_EVENT_EVENT_TESTER, _cb_rec_3, NULL);
|
|
|
|
efl_event_callback_call(event->object, EFL_TEST_EVENT_EVENT_TESTER, data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-26 11:19:28 -07:00
|
|
|
EFL_START_TEST(eo_event_call_in_call)
|
2016-12-01 11:34:46 -08:00
|
|
|
{
|
|
|
|
Test_Data data;
|
|
|
|
Eo *obj;
|
|
|
|
|
2018-03-15 09:50:20 -07:00
|
|
|
obj = efl_add_ref(efl_test_event_class_get(), NULL);
|
2016-12-01 11:34:46 -08:00
|
|
|
efl_event_callback_priority_add(obj, EFL_TEST_EVENT_EVENT_TESTER, EFL_CALLBACK_PRIORITY_BEFORE, _cb_rec_1, &data);
|
|
|
|
|
|
|
|
memset(&data, 0, sizeof(Test_Data));
|
|
|
|
efl_event_callback_call(obj, EFL_TEST_EVENT_EVENT_TESTER, NULL);
|
|
|
|
ck_assert_int_ne(data.event1, 0);
|
|
|
|
ck_assert_int_ne(data.event2, 0);
|
|
|
|
ck_assert_int_ne(data.event3, 0);
|
|
|
|
|
|
|
|
}
|
2018-03-26 11:19:28 -07:00
|
|
|
EFL_END_TEST
|
eo: ensure the generation is correctly clamped
Summary:
when a few recursive event emissions are happening, and in some deep
recursive level a subscription to the same object is happening, the
subscription would just be executed when the complete recursion is done.
that is wrong. The subscription needs to be executed when the event is
called after the subscription is added, undepended from any recursive
level. That fixes that and adds a regression test for it.
This was discovered in e, since e gives a lot of error messages about a eo object
that is already freed. It turned out this object is returned from evas, and exactly
the above happened to the EFL_EVENT_DEL subscription of that object.
Test Plan: make check
Reviewers: tasn, cedric, stefan_schmidt
Subscribers: stefan_schmidt, netstar, zmike, raster, jpeg
Differential Revision: https://phab.enlightenment.org/D4656
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-02-16 13:37:16 -08:00
|
|
|
|
|
|
|
static Eina_Bool emitted = 0;
|
|
|
|
|
|
|
|
static void
|
|
|
|
_generation_clamp_step3(void *data EINA_UNUSED, const Efl_Event *e EINA_UNUSED)
|
|
|
|
{
|
|
|
|
emitted = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_generation_clamp_subscribe(void *data EINA_UNUSED, const Efl_Event *e)
|
|
|
|
{
|
|
|
|
//generation is 2
|
|
|
|
efl_event_callback_add(e->object, EFL_TEST_EVENT_EVENT_TESTER_CLAMP_TEST, _generation_clamp_step3, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_generation_clamp_step1(void *data EINA_UNUSED, const Efl_Event *e)
|
|
|
|
{
|
|
|
|
//generation is 1
|
|
|
|
efl_event_callback_call(e->object, EFL_TEST_EVENT_EVENT_TESTER_SUBSCRIBE, NULL);
|
|
|
|
|
|
|
|
efl_event_callback_call(e->object, EFL_TEST_EVENT_EVENT_TESTER_CLAMP_TEST, NULL);
|
|
|
|
efl_event_callback_call(e->object, EFL_TEST_EVENT_EVENT_TESTER_CLAMP_TEST, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-03-26 11:19:28 -07:00
|
|
|
EFL_START_TEST(eo_event_generation_bug)
|
eo: ensure the generation is correctly clamped
Summary:
when a few recursive event emissions are happening, and in some deep
recursive level a subscription to the same object is happening, the
subscription would just be executed when the complete recursion is done.
that is wrong. The subscription needs to be executed when the event is
called after the subscription is added, undepended from any recursive
level. That fixes that and adds a regression test for it.
This was discovered in e, since e gives a lot of error messages about a eo object
that is already freed. It turned out this object is returned from evas, and exactly
the above happened to the EFL_EVENT_DEL subscription of that object.
Test Plan: make check
Reviewers: tasn, cedric, stefan_schmidt
Subscribers: stefan_schmidt, netstar, zmike, raster, jpeg
Differential Revision: https://phab.enlightenment.org/D4656
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-02-16 13:37:16 -08:00
|
|
|
{
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The idea is:
|
|
|
|
*
|
|
|
|
* #1 a event gets emitted (generation is 1)
|
|
|
|
* #2 a event gets emitted as a result of #1 (generation is 2)
|
|
|
|
* in a callback from #2 a new subscription for E is added (S) (generation of it is 2)
|
|
|
|
* in a callback of #1 event E is emitted (generation is 2)
|
|
|
|
* S now MUST get executed (Here is the bug generation of S is 2 and of emission is 2, event gets skipped)
|
|
|
|
* subscription adds a callback to a event
|
|
|
|
*/
|
|
|
|
|
|
|
|
Eo *obj;
|
|
|
|
|
2018-03-15 09:50:20 -07:00
|
|
|
obj = efl_add_ref(efl_test_event_class_get(), NULL);
|
eo: ensure the generation is correctly clamped
Summary:
when a few recursive event emissions are happening, and in some deep
recursive level a subscription to the same object is happening, the
subscription would just be executed when the complete recursion is done.
that is wrong. The subscription needs to be executed when the event is
called after the subscription is added, undepended from any recursive
level. That fixes that and adds a regression test for it.
This was discovered in e, since e gives a lot of error messages about a eo object
that is already freed. It turned out this object is returned from evas, and exactly
the above happened to the EFL_EVENT_DEL subscription of that object.
Test Plan: make check
Reviewers: tasn, cedric, stefan_schmidt
Subscribers: stefan_schmidt, netstar, zmike, raster, jpeg
Differential Revision: https://phab.enlightenment.org/D4656
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-02-16 13:37:16 -08:00
|
|
|
emitted = 0;
|
|
|
|
efl_event_callback_priority_add(obj, EFL_TEST_EVENT_EVENT_TESTER, EFL_CALLBACK_PRIORITY_BEFORE, _generation_clamp_step1, NULL);
|
|
|
|
efl_event_callback_priority_add(obj, EFL_TEST_EVENT_EVENT_TESTER_SUBSCRIBE, EFL_CALLBACK_PRIORITY_BEFORE, _generation_clamp_subscribe, NULL);
|
|
|
|
efl_event_callback_call(obj, EFL_TEST_EVENT_EVENT_TESTER, NULL);
|
|
|
|
|
|
|
|
ck_assert_int_ne(emitted, 0);
|
|
|
|
|
|
|
|
}
|
2018-03-26 11:19:28 -07:00
|
|
|
EFL_END_TEST
|
eo: ensure the generation is correctly clamped
Summary:
when a few recursive event emissions are happening, and in some deep
recursive level a subscription to the same object is happening, the
subscription would just be executed when the complete recursion is done.
that is wrong. The subscription needs to be executed when the event is
called after the subscription is added, undepended from any recursive
level. That fixes that and adds a regression test for it.
This was discovered in e, since e gives a lot of error messages about a eo object
that is already freed. It turned out this object is returned from evas, and exactly
the above happened to the EFL_EVENT_DEL subscription of that object.
Test Plan: make check
Reviewers: tasn, cedric, stefan_schmidt
Subscribers: stefan_schmidt, netstar, zmike, raster, jpeg
Differential Revision: https://phab.enlightenment.org/D4656
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-02-16 13:37:16 -08:00
|
|
|
|
2019-12-11 01:23:33 -08:00
|
|
|
static void
|
|
|
|
_inc_when_called(void *data, const Efl_Event *ev EINA_UNUSED)
|
|
|
|
{
|
|
|
|
int *called = (int*)data;
|
|
|
|
*called += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
EFL_START_TEST(eo_event_fowarder_test)
|
|
|
|
{
|
|
|
|
Eo *obj1, *obj2;
|
|
|
|
int called = 0;
|
|
|
|
|
|
|
|
obj1 = efl_add_ref(efl_test_event_class_get(), NULL);
|
|
|
|
obj2 = efl_add_ref(efl_test_event_class_get(), NULL);
|
|
|
|
efl_event_callback_add(obj2, EFL_TEST_EVENT_EVENT_TESTER, _inc_when_called, &called);
|
|
|
|
|
|
|
|
efl_event_callback_forwarder_priority_add(obj1, EFL_TEST_EVENT_EVENT_TESTER, EFL_CALLBACK_PRIORITY_BEFORE, obj2);
|
|
|
|
efl_event_callback_call(obj1, EFL_TEST_EVENT_EVENT_TESTER, NULL);
|
|
|
|
ck_assert_int_eq(called, 1);
|
|
|
|
called = 0;
|
|
|
|
|
|
|
|
//call it a second time with another forwarder
|
|
|
|
efl_event_callback_forwarder_priority_add(obj1, EFL_TEST_EVENT_EVENT_TESTER, EFL_CALLBACK_PRIORITY_BEFORE, obj2);
|
|
|
|
efl_event_callback_call(obj1, EFL_TEST_EVENT_EVENT_TESTER, NULL);
|
|
|
|
ck_assert_int_eq(called, 1); //we still should only emit it once
|
|
|
|
called = 0;
|
|
|
|
|
|
|
|
//delete it, nothing should happen now
|
|
|
|
efl_event_callback_forwarder_del(obj1, EFL_TEST_EVENT_EVENT_TESTER, obj2);
|
|
|
|
efl_event_callback_call(obj1, EFL_TEST_EVENT_EVENT_TESTER, NULL);
|
|
|
|
ck_assert_int_eq(called, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
EFL_END_TEST
|
eo: ensure the generation is correctly clamped
Summary:
when a few recursive event emissions are happening, and in some deep
recursive level a subscription to the same object is happening, the
subscription would just be executed when the complete recursion is done.
that is wrong. The subscription needs to be executed when the event is
called after the subscription is added, undepended from any recursive
level. That fixes that and adds a regression test for it.
This was discovered in e, since e gives a lot of error messages about a eo object
that is already freed. It turned out this object is returned from evas, and exactly
the above happened to the EFL_EVENT_DEL subscription of that object.
Test Plan: make check
Reviewers: tasn, cedric, stefan_schmidt
Subscribers: stefan_schmidt, netstar, zmike, raster, jpeg
Differential Revision: https://phab.enlightenment.org/D4656
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-02-16 13:37:16 -08:00
|
|
|
|
2016-11-29 11:18:44 -08:00
|
|
|
void eo_test_event(TCase *tc)
|
|
|
|
{
|
|
|
|
tcase_add_test(tc, eo_event);
|
2016-12-01 11:34:46 -08:00
|
|
|
tcase_add_test(tc, eo_event_call_in_call);
|
eo: ensure the generation is correctly clamped
Summary:
when a few recursive event emissions are happening, and in some deep
recursive level a subscription to the same object is happening, the
subscription would just be executed when the complete recursion is done.
that is wrong. The subscription needs to be executed when the event is
called after the subscription is added, undepended from any recursive
level. That fixes that and adds a regression test for it.
This was discovered in e, since e gives a lot of error messages about a eo object
that is already freed. It turned out this object is returned from evas, and exactly
the above happened to the EFL_EVENT_DEL subscription of that object.
Test Plan: make check
Reviewers: tasn, cedric, stefan_schmidt
Subscribers: stefan_schmidt, netstar, zmike, raster, jpeg
Differential Revision: https://phab.enlightenment.org/D4656
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-02-16 13:37:16 -08:00
|
|
|
tcase_add_test(tc, eo_event_generation_bug);
|
2019-12-11 01:23:33 -08:00
|
|
|
tcase_add_test(tc, eo_event_fowarder_test);
|
2016-11-29 11:18:44 -08:00
|
|
|
}
|
|
|
|
|
eo: ensure the generation is correctly clamped
Summary:
when a few recursive event emissions are happening, and in some deep
recursive level a subscription to the same object is happening, the
subscription would just be executed when the complete recursion is done.
that is wrong. The subscription needs to be executed when the event is
called after the subscription is added, undepended from any recursive
level. That fixes that and adds a regression test for it.
This was discovered in e, since e gives a lot of error messages about a eo object
that is already freed. It turned out this object is returned from evas, and exactly
the above happened to the EFL_EVENT_DEL subscription of that object.
Test Plan: make check
Reviewers: tasn, cedric, stefan_schmidt
Subscribers: stefan_schmidt, netstar, zmike, raster, jpeg
Differential Revision: https://phab.enlightenment.org/D4656
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-02-16 13:37:16 -08:00
|
|
|
|
|
|
|
|
2016-11-29 11:18:44 -08:00
|
|
|
//class implementation
|
|
|
|
|
eo: Rename EAPI macro to EO_API in Eo library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
= The Rationale =
This patch is from a series of patches to rename EAPI symbols to
specific library DSOs.
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
LIBAPI is the only solution that works for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Reviewers: jptiz, lucas, vtorri, woohyun
Reviewed By: jptiz, lucas, vtorri
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12203
2020-12-09 08:50:29 -08:00
|
|
|
EO_API_WEAK const Efl_Event_Description _EFL_TEST_EVENT_EVENT_TESTER =
|
2016-11-29 11:18:44 -08:00
|
|
|
EFL_EVENT_DESCRIPTION("tester");
|
|
|
|
|
eo: Rename EAPI macro to EO_API in Eo library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
= The Rationale =
This patch is from a series of patches to rename EAPI symbols to
specific library DSOs.
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
LIBAPI is the only solution that works for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Reviewers: jptiz, lucas, vtorri, woohyun
Reviewed By: jptiz, lucas, vtorri
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12203
2020-12-09 08:50:29 -08:00
|
|
|
EO_API_WEAK const Efl_Event_Description _EFL_TEST_EVENT_EVENT_TESTER_SUBSCRIBE =
|
eo: ensure the generation is correctly clamped
Summary:
when a few recursive event emissions are happening, and in some deep
recursive level a subscription to the same object is happening, the
subscription would just be executed when the complete recursion is done.
that is wrong. The subscription needs to be executed when the event is
called after the subscription is added, undepended from any recursive
level. That fixes that and adds a regression test for it.
This was discovered in e, since e gives a lot of error messages about a eo object
that is already freed. It turned out this object is returned from evas, and exactly
the above happened to the EFL_EVENT_DEL subscription of that object.
Test Plan: make check
Reviewers: tasn, cedric, stefan_schmidt
Subscribers: stefan_schmidt, netstar, zmike, raster, jpeg
Differential Revision: https://phab.enlightenment.org/D4656
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-02-16 13:37:16 -08:00
|
|
|
EFL_EVENT_DESCRIPTION("tester");
|
|
|
|
|
eo: Rename EAPI macro to EO_API in Eo library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
= The Rationale =
This patch is from a series of patches to rename EAPI symbols to
specific library DSOs.
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
LIBAPI is the only solution that works for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Reviewers: jptiz, lucas, vtorri, woohyun
Reviewed By: jptiz, lucas, vtorri
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12203
2020-12-09 08:50:29 -08:00
|
|
|
EO_API_WEAK const Efl_Event_Description _EFL_TEST_EVENT_EVENT_TESTER_CLAMP_TEST =
|
eo: ensure the generation is correctly clamped
Summary:
when a few recursive event emissions are happening, and in some deep
recursive level a subscription to the same object is happening, the
subscription would just be executed when the complete recursion is done.
that is wrong. The subscription needs to be executed when the event is
called after the subscription is added, undepended from any recursive
level. That fixes that and adds a regression test for it.
This was discovered in e, since e gives a lot of error messages about a eo object
that is already freed. It turned out this object is returned from evas, and exactly
the above happened to the EFL_EVENT_DEL subscription of that object.
Test Plan: make check
Reviewers: tasn, cedric, stefan_schmidt
Subscribers: stefan_schmidt, netstar, zmike, raster, jpeg
Differential Revision: https://phab.enlightenment.org/D4656
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-02-16 13:37:16 -08:00
|
|
|
EFL_EVENT_DESCRIPTION("tester");
|
|
|
|
|
|
|
|
|
2016-11-29 11:18:44 -08:00
|
|
|
static const Efl_Class_Description _efl_test_event_class_desc = {
|
|
|
|
EO_VERSION,
|
|
|
|
"Efl_Test_Event",
|
|
|
|
EFL_CLASS_TYPE_REGULAR,
|
|
|
|
sizeof(Efl_Test_Event_Data),
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
EFL_DEFINE_CLASS(efl_test_event_class_get, &_efl_test_event_class_desc, EFL_OBJECT_CLASS, NULL);
|