Commit Graph

12 Commits

Author SHA1 Message Date
Mike Blumenkrantz 65c47edc3d ecore: also error when trying to add an event handler for a type 0 event
Summary:
this is not a valid event type to add a handler for, it indicates an
uninitialized event which means the component is not active and everything
will break

@fix
Depends on D9255

Reviewers: bu5hm4n

Reviewed By: bu5hm4n

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9256
2019-07-10 13:57:38 -04:00
Mike Blumenkrantz 1feff299ff ecore: throw an error when trying to register a handler for a nonexistent event type
Summary:
this should not be a silent return since event handlers are depended upon
so heavily
Depends on D9254

Reviewers: bu5hm4n

Reviewed By: bu5hm4n

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9255
2019-07-10 13:57:36 -04:00
Marcel Hollerbach cc9f236a29 efl_loop: remove message_handler_get
it appears that this could be emulated with other functions. Plus the
function had the limitation, that no constructors could be used.

ref T7597

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D7985
2019-02-21 19:13:41 +01:00
Marcel Hollerbach 37d2d378ec eolian: drop class function overriding
Until this commit eo did class functions as part of the vtable, which
enabled those functions to be overwritten in classes inheriting another
class. However in task T7675 we decided that this is not really good for
bindings, as most OOP languages do not support this sort of feature.

After this commit eolian realizes class function completly outside of
the vtable, the c-symbol that is the class funciton is now just directly
redirecting to a implementation, without the involvement of the vtable.

This also means a change to the syntax created by eo:

Calling before:
  class_function(CLASS_A);
Calling after:
   class_function();

Implementation before:
   class_function(const Eo *obj, void *pd) { ... }
Implementation after:
   class_function(void) { ... }

This fixes T7675.

Co-authored-by: lauromauro <lauromoura@expertisesolutions.com.br>

Reviewed-by: Daniel Kolesa <daniel@octaforge.org>
Differential Revision: https://phab.enlightenment.org/D7901
2019-02-13 16:59:58 +01:00
Shinwoo Kim ad97989b28 ecore_event: initialize uninitialized variable
Summary:
The following commit (1) made an abort (2)

(1) commit d1e4c6bab8
Author: Jean Guyomarc'h <jean@guyomarch.bzh>
Date:   Mon Aug 27 12:04:35 2018 +0900

    ecore: fix built-in event types generation

(2) abort
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)
/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)
/home/kimcinoo/install/lib/libecore.so.1(+0x237d7)
/home/kimcinoo/install/lib/libeo.so.1(efl_destructor+0x64)
/home/kimcinoo/install/lib/libeo.so.1(+0x18029)
/home/kimcinoo/install/lib/libeo.so.1(efl_unref+0x44c)
/home/kimcinoo/install/lib/libecore.so.1(+0x201f2)
/home/kimcinoo/install/lib/libecore.so.1(ecore_shutdown+0x145)
/home/kimcinoo/Upstream/efl/src/tests/ecore/.libs/lt-efl_app_suite(+0xb85d)
/home/kimcinoo/install/lib/libcheck.so.0(srunner_run_tagged+0xa13)
/home/kimcinoo/Upstream/efl/src/tests/ecore/.libs/lt-efl_app_suite(+0xead9)
/home/kimcinoo/Upstream/efl/src/tests/ecore/.libs/lt-efl_app_suite(+0x4ade)
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)
/home/kimcinoo/Upstream/efl/src/tests/ecore/.libs/lt-efl_app_suite

And following commit (3) fixed the abort.

(3) commit 3f306491a3
Author: Yeongjong Lee <cleanlyj@naver.com>
Date:   Mon Sep 3 15:55:13 2018 +0000

    ecore_event: fix ecore event handler iterator range

The above commit fixed the abort though, we could access uninitialized memory
and make another abort again. This would prevent such unwanted case.

Reviewers: Hermet, YOhoho, bu5hm4n, netstar

Reviewed By: netstar

Subscribers: netstar, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6970
2018-09-04 11:54:17 +01:00
Yeongjong Lee 3f306491a3 ecore_event: fix ecore event handler iterator range
event handler start at 1 (see _ecore_event_message_handler_type_new and
_ecore_event_message_handler_efl_object_constructor) so that handlers[0] is not
allocated. this patch avoid invalid memory access.

this fixes T7349
Differential Revision: https://phab.enlightenment.org/D6966
2018-09-03 18:13:32 +02:00
Jean Guyomarc'h d1e4c6bab8 ecore: fix built-in event types generation
Summary:
Ecore internally uses 10 events, from ECORE_EVENT_SIGNAL_USER=1 to
ECORE_EVENT_SYSTEM_TIMEDATE_CHANGED=10. The Ecore.Event.Message_Handler
singleton that holds the counter of events is initialized with -1.
This is followed in _ecore_event_init() by ten calls to
ecore_event_message_handler_type_new(), which increase the counter of
event by one each.

This results in an event counter to be 9 (-1 + 10) at the end of the
initialization of ecore_events. This means that the next event to be
created will have a value of 10, which will overlap with
ECORE_EVENT_SYSTEM_TIMEDATE_CHANGED. As such, these two distinct events
will be aliased and their associated handlers will be called at
unexpected times, with unexpected data.

By changing the constructor value from -1 to 0, we prevent this event
aliasing.

Fixes T6605

Reviewers: zmike, Hermet

Reviewed By: Hermet

Subscribers: cedric, #reviewers, #committers, zmike

Tags: #efl

Maniphest Tasks: T6605

Differential Revision: https://phab.enlightenment.org/D6894
2018-08-27 12:04:36 +09:00
Mike Blumenkrantz 6a500331bd ecore: fix event flushing to not erase+leak events
stealing the message data here prevents events which aren't being flushed from
ever being usable again and is unnecessary since the free callback will be
automatically called during the destructor

ref 5dd52fd09b
2018-02-07 12:12:22 -05:00
Mike Blumenkrantz da9eef6027 ecore: add function for prepending an event handler
@feature
2018-01-30 13:02:07 -05:00
Jean-Philippe Andre 06fea06c86 ecore: Simplify code 2017-12-18 19:54:31 +09:00
Jean-Philippe Andre 796b1dd566 ecore: Fix legacy message handlers destruction 2017-12-18 19:54:31 +09:00
Carsten Haitzler 5dd52fd09b ecore - begin moving data into the efl loop data in the object
we really should have data inside the loop object, so begin moving it
one small thing at a time. this is the basics that will allow multiple
efl loops. make an eo efl object and class for fd handlers that is efl loop
bound make fd handlers really bound to their parent loop and not global  as
well as have a nice class/obj. create an message queue per loop and
put legacy ecore events on top of it... and a lot more.

this is not 100% done, but it's a lot of the core and groundwork.
various ecore_timer_add(), ecore_diler_add() etc. need changes.

The following still need doing:

  ecore_timer (internal usage for sure)
  ecore_idler (internal usage for sure)
  ecore_idle_enterer
  ecore_idle_exiter
  ecore_pollers? (is the new efl loop stuff ok?)
  ecore_exe (fork/spawn from any thread and track exe from that thread?)
  ecore_signal code
  ecore_throttle (should we have a single global too? we have per loop)
  ecore_app ? (should every loop be given its own argv/argc?)

Lots of internal ecore code uses/calls these legacy calls and we
should have efl loop replacements and/or use the ones we have

The following will bedifferently designed for loop to loop
control/messaging/ipc:

  ecore_thread
  ecore_pipe
2017-12-15 14:16:53 +09:00