Commit Graph

826 Commits

Author SHA1 Message Date
Carsten Haitzler 4917910b49 ecore pipe - fix windows to not segv on zero data in pipe there 2018-04-24 15:13:57 +09:00
Daniel Zaoui 9cbba2d0b4 Fix exit code setting for legacy applications
The value must be given to eina_value_set and not a pointer to a
Eina_Value.
This bug results in always getting wrong exit code when the application
terminates.
2018-04-22 15:44:41 +03:00
Hermet Park fd85423ae3 ecore: fix a potential memory leak.
if the func argument is null, allocated memory won't be freed properly.
return it as soon as possible.

@fix
2018-04-20 13:29:46 +09:00
Daniel Kolesa fcae7cab27 eolian gen: enable constness generation on property getter impls
This changes a lot of things all across the EFL. Previously,
methods tagged @const had both their external prototype and
internal impl generated with const on object, while property
getters only had const on the external API. This is now changed
and it all has const everywhere.

Ref T6859.
2018-04-17 20:31:55 +02:00
Mike Blumenkrantz 9dcf6f71d0 ecore: further reduce pipe wait time during shutdown.
Summary:
it turns out that 0.01s is actually a lot, accounting for something like
20s across a run of 'make check' while providing no additional value

ref e0c8ab4c79
ref T6825
ref T6864

Reviewers: cedric

Maniphest Tasks: T6864, T6825

Differential Revision: https://phab.enlightenment.org/D5941

Reviewed-by: Cedric BAIL <cedric@osg.samsung.com>
2018-04-16 10:57:32 -07:00
Hermet Park 3a4baabaaa ecore: fix a potential memory leak.
if the func argument is null, allocated memory won't be freed properly.
return it as soon as possible.

@fix
2018-04-09 11:46:13 +09:00
Mike Blumenkrantz e0c8ab4c79 ecore: reduce pipe wait time during shutdown
Summary:
this is only meant to listen to data which is currently available,
not wait for new data

@fix

Depends on D5866

Reviewers: cedric

Reviewed By: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D5867

Reviewed-by: Cedric Bail <cedric@osg.samsung.com>
2018-04-06 10:09:00 -07:00
Mike Blumenkrantz 0fddfe199f ecore: poll the thread pipe twice during shutdown
Summary:
this resolves a race condition when a thread join was pending during
shutdown but a pipe write was needed in order for the join to be
successfully executed before shutdown had occurred

@fix

Reviewers: cedric

Reviewed By: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D5866

Reviewed-by: Cedric Bail <cedric@osg.samsung.com>
2018-04-06 10:08:57 -07:00
Cedric Bail def3bb6eec ecore: rely on object being destroyed on parent invalidate. 2018-04-05 11:52:12 -07:00
Cedric Bail a9fbaf16d3 ecore: pipe fd can become invalid while being processed. 2018-04-05 11:52:12 -07:00
Shinwoo Kim 3cd2243028 Fix static analysis result
[Dereference after null check]

(1) src/lib/ecore/ecore_main.c
 - _efl_loop_handler_efl_object_finalize checks if pd->loop_data is NULL.
   After that, _handler_reset > _handler_clear > _ecore_main_fd_handler_del >
   _ecore_main_fdh_pool_del is directly dereferencing pd->pool_data.
 - _efl_loop_handler_efl_object_parent_set checks if pd->loop_data as well.
   Then it calls _handler_reset as well.

(2) src/lib/ecore_wayland/ecore_wl_dnd.c
  - ecore_wl_dnd_selection_set checks if t - result of wl_array_add - is NULL.
    And it is dereferecing t directly for wl_data_source_offer.

(3) src/lib/elementary/efl_ui_dnd.c
 - Third parameter const char *data could be NULL.
   In this case strlen dereferences NULL. The data should be non NULL value.
   I have checked this with Mr. Thiep Ha.

(4) src/lib/evas/canvas/evas_object_inform.c
 - _efl_canvas_object_efl_gfx_stack_stack_below checks if obj->layer is NULL.
   So it could call evas_object_inform_call_call_restack which is dereferencing
   obj->layer directly.
2018-04-05 19:40:57 +09:00
Carsten Haitzler b90cd2f683 efl threadio - make call and call sync func proto same as efl events
well call sync returns a void * too.... instead of just void return
(nothing) but this makes it easier to write and maintain code due to
consistency of function callback signatures.
2018-04-05 18:52:57 +09:00
Carsten Haitzler 78d7fded5d efl exe - map some "well known" exit codes to specific errnos 2018-04-05 18:52:57 +09:00
Carsten Haitzler 6fbf6d6c67 efl task - support flag to ignore exit code errors for future resolve 2018-04-05 18:52:57 +09:00
Carsten Haitzler 6e308e6039 ecore - thread - document thread max limits more sensibly
leave the exact numbers less defined because core count can change on
the fly and could be virtually limited by policy in future etc. so
keep things less exactly defined so people dont go depending on exact
results which was never really intended.
2018-04-05 18:52:57 +09:00
Hermet Park ec7bcc79e7 ecore: resolve the possible use of invalid handle.
Signed-Off-By: JongMin Lee<jm105.lee@samsung.com>
2018-04-05 15:15:34 +09:00
Carsten Haitzler 308e9586dd ecore - efl exe - use better exit codes
127 is the "command not found" shell exeit code, 126 is "the command
file is found but is not executable" which i think i'd interpret not
just for execute permissions but that something is preventing it from
executing in general.
2018-03-26 23:17:56 +09:00
Carsten Haitzler 0a3e7c05e4 ecore - efl exe + thread - error print if deleted before task is done
both exe and thread objects must (currently) stay around until the
child thread or exe (task) is done. if you don't do this "bad things
can happen". so produce an error to let the programmer know.
2018-03-26 23:17:56 +09:00
Cedric BAIL bc18b7e7ad efl: replace efl_del with efl_unref for cases where no parent exists
Signed-off-by: Mike Blumenkrantz <zmike@osg.samsung.com>
2018-03-20 17:20:57 -07:00
Cedric BAIL 4c4177ac20 efl: use efl_add_ref to create objects which have no parent
Signed-off-by: Mike Blumenkrantz <zmike@osg.samsung.com>
2018-03-20 17:20:56 -07:00
Carsten Haitzler 6391a13558 efl.task - move to returning future insead of bool + exit event
title says it all...
2018-03-20 20:56:46 +09:00
Cedric Bail c3c5620c1c ecore: the main loop has no parent and only one ref, let's properly create it. 2018-03-19 15:33:11 -07:00
Cedric BAIL 950e2c13bb efl_promise: avoid invalid calls when unsetting parent
if promise has no parent then the promise's loop is null

Signed-off-by: Mike Blumenkrantz <zmike@osg.samsung.com>
2018-03-13 15:14:50 -07:00
Jean Guyomarc'h 363ea8676e efl_threadio: always return a value to silence warning 2018-03-13 18:38:46 +01:00
Jean Guyomarc'h 1168bd0608 efl_loop: fix exit code of the loop
For numeric types, eina_value_set() accepts values instead of references
on the value to be set. Hence, we were affecting as the exit code of the
loop a garbage value, yielding to invalid results.
2018-03-13 18:34:37 +01:00
Carsten Haitzler 249f50098f ecore - efl thread - remove unused local vars 2018-03-10 20:03:32 +09:00
Carsten Haitzler 965f257e70 ecore - efl exe/thread - only allow run once ever 2018-03-10 20:02:09 +09:00
Cedric BAIL edda05e4d0 ecore: do not remove a timer that has already been removed. 2018-03-08 17:00:03 -08:00
Cedric Bail a5d5965b68 ecore: avoid calls to provider_find on invalidated objects in timer class
Signed-off-by: Mike Blumenkrantz <zmike@osg.samsung.com>
2018-03-08 15:46:45 -08:00
Cedric Bail 83233a976d ecore: rely on Efl.Object.invalidate instead of a hack for Efl.Model.Container.Item. 2018-03-07 10:59:20 -08:00
Carsten Haitzler 9c8749b99a ecore - go back to args 0 being the command and 1+ being actual args
so this is then inconsistent with efl.exe and efl.thread, so go back
to being normal with 0'th arg being the binary itself jsut to make
sure we have conistent usage.
2018-03-07 02:32:15 +09:00
Carsten Haitzler 6865ad1773 ecore - efl threads - add thredio class
this adds a simple indata and outdata void ptr to begin that you can
set on efl.thread objects (set the indata) and get the outdata too to
get results. then on the efl.appthread side the indata is set on the
efl.appthread before it runs and on quit the thresad can set the
outdata on the appthread, and this appears back on the efl.thread
object in the parent thread.

so you can basically share pointers to anything in and out this way on
start/exit in addition to string args etc.

the reason i made it an extra class (mixin actually) is for future
expansion. sharing more complex data - eina values maybe or objects as
long as they are shared objects, and perhaps acting as an interface
for calling a function at the other end like ecore_thread_async_call
etc.
2018-03-07 02:32:15 +09:00
Carsten Haitzler 1ac60fe022 ecore efl exe/task/thread - move stdin/out flags to task class
also use them in efl thread to determine if io handlers are set up and
pipes created at all etc.
2018-03-07 02:32:15 +09:00
Carsten Haitzler 7d934a4a0d efl loop - remove commented out code left over from work on theads etc 2018-03-03 18:59:40 +09:00
Carsten Haitzler aabbb211ea efl.task - add an api to clear environment 2018-03-03 18:01:05 +09:00
Carsten Haitzler 6c0ed8fe76 efl exe - fix indent 2018-03-03 17:57:17 +09:00
Carsten Haitzler d80ef6d7a9 efl loop promises - cleare out promise data to null
so there is something broken in the complect efl promise/loop promise
that the clear of promises on loop destroy is clearing
promises/futures that have already triggered (loop timer ones). i've
spent enough time figuring out that it is happening.
_efl_loop_timeout_del() simple doenst ensure the future in
pending_futures for that promise is removed from the list. getting the
future from the promise handle is an exercise in pain... so i'm not
continuing with that path and will just ignore it.

but for now filling the promise data with null at least means if the
menory is re-used after free it wont see garbage freed ptrs and get
nulls so its easier to track.
2018-03-03 17:15:10 +09:00
Carsten Haitzler 1bdd9e4dd1 ecore - a different take on efl.app class as a super class to efl.loop
so the MAIN loop is actually an efl.app object. which inherits from
efl.loop. the idea is that other loops in threads will not be efl.app
objects. thread on the creator side return an efl.thread object.
inside the thread, like the mainloop, there is now an efl.appthread
object that is for all non-main-loop threads.

every thread (main loop or child) when it spawns a thread is the
parent. there are i/o pipes from parnet to child and back. so parents
are generally expected to, if they want to talk to child thread, so
use the efl.io interfaces on efl.thread, and the main loop's elf.app
class allows you to talk to stdio back to the parent process like the
efl.appthread does the same using the efl.io interfaces to talk to its
parent app or appthread. it's symmetrical

no tests here - sure. i have been holding off on tests until things
settle. that's why i haven't done them yet. those will come back in a
subsequent commit

for really quick examples on using this see:

https://phab.enlightenment.org/F2983118
https://phab.enlightenment.org/F2983142

they are just my test code for this.

Please see this design document:

https://phab.enlightenment.org/w/efl-loops-threads/
2018-03-03 13:40:33 +09:00
Carsten Haitzler 1c74aaa7e9 Revert "cxx: Fix manual code after efl_app change."
This reverts commit 135154303b.

Revert "efl: move signal events from efl.loop to efl.app"
This reverts commit 3dbca39f98.

Revert "efl: add test suite for efl_app"
This reverts commit 3e94be5d73.

Revert "efl: create Efl.App class, the parent of Efl.Loop"
This reverts commit 28fe00b94e.

Go back to before efl.app because I think this should be done with
superclassing here not a parent object. reasons?

1. multiple loops per single thread make no sense. so if multilpe loop
objects they wont be contained in a single app object and then deleted
like this.
2. the app object is not really sharable in this design so it cant be
accessed from other threads
3. it makes it harder to get the main loop or app object (well 2 func
calls one calling the other and more typing. it is longer to type and
more work where it is not necessary, and again it can't work from
other threads unless we go duplicating efl.app per thread and then
what is the point of splittyign out the signal events from efl.loop
then?)

etc.
2018-03-03 13:40:33 +09:00
Mike Blumenkrantz 3dbca39f98 efl: move signal events from efl.loop to efl.app
these are process-wide and not loop-specific
2018-02-26 14:02:51 -05:00
Mike Blumenkrantz 28fe00b94e efl: create Efl.App class, the parent of Efl.Loop 2018-02-26 14:02:51 -05:00
Carsten Haitzler c422359d2e ecore signal - memset data about to be sent over to 0 first
makes valgrind happier and less noise, though not strictly needed,
thus not fixing a bug...
2018-02-26 15:28:06 +09:00
Carsten Haitzler 21b4321d4c ecore anim - use pointers to real things for epoll objects
while really "fake" they are real pointers and thus shouldnt get
complaints from tools about invalid ptrs... doesnt fix any bug though.
2018-02-26 15:26:27 +09:00
Jean Guyomarc'h 87efca57ef ecore_signal: check the return value of write(2)
Some glibc declare write(2) with the attribute warn unused result.
So we now ensure that the calls to write(2) are successful. Otherwise,
we print an error and update errno accordingly.
2018-02-25 10:40:50 +01:00
Jean Guyomarc'h 7ff60afe5c efl_exe: check the calls to pipe(2)
Some glibc versions declare pipe(2) with a warn unused result attribute,
leading to compile-time warnings when pipe(2)'s return value is not
checked.

If pipe(2) fails, we now print an error and make the calling function
fail.
2018-02-25 10:38:57 +01:00
Marcel Hollerbach c4f33c67a8 move from efl.vpath to eina_vpath
The usages from efl.vpath are moved to to eina_vpath
2018-02-22 09:26:55 +01:00
Carsten Haitzler 885ea03230 ecore - osx - build where clearenv doesnt exist
osx was uncivilied .... it didn't have a nice clearenv. fixed that now
and do it the not so nice way and juat set environ to NULL
2018-02-22 00:15:57 +09:00
Carsten Haitzler d262ff447e ecore - fd handler - dont set legacy flag on null fdhandlers
now passes make check again.
2018-02-21 19:05:48 +09:00
Carsten Haitzler 8c62e2a817 ecore - fd handlers - only delete legacy eo objects in handlers
if its a non-legacy loop handler that also binds an fd handler
internally (the 2 things are linked as a pair) then on loop del, dont
del the objet as the obj del should handle things elsehwere.
2018-02-21 16:56:38 +09:00
Carsten Haitzler 47ff2d8126 ecore - start work on efl task/exe/thread
this is  astart of the work for having a common task class/interface
between loops, threads ane exe's so the i/o is all symmetric and works
the same way between all of them as well as similarly for launching
and knowing when the exit etc. etc.

this is not final and not perfect, but it's a start. comments of
course welcome
2018-02-21 16:56:38 +09:00