Commit Graph

269 Commits

Author SHA1 Message Date
Tom Hacohen d6b18c1e25 Eo base: print an error when an object with a parent is destructed.
This should not happen. Objects with parents must have their parents
unset before they reach refcount == 0. That's because the parent is the
one holding the refcount. This means that if we get to the destructor
(object is deleted) while a parent is still set, we have an error
scenario.
2015-08-26 14:17:28 +01:00
Tom Hacohen acc158a2bf Revert "Revert "Eo base: Change parent_set to be an assignment of ref.""
Had to revert it until I pushed the changes to elm, which I had issues
with. Now the patch can safely go back in.

This reverts commit 37abea3831.
2015-08-26 10:47:06 +01:00
Tom Hacohen 37abea3831 Revert "Eo base: Change parent_set to be an assignment of ref."
Damn, this breaks some things. Reverting until fixed.

This reverts commit 9c78ee0bf4.
2015-08-26 10:33:24 +01:00
Tom Hacohen 9c78ee0bf4 Eo base: Change parent_set to be an assignment of ref.
After this change, parent_set assigns a ref, so for example:
  obj = eo_add(CLASS, parent); /* Ref is 1 */
  eo_do(obj, eo_parent_set(parent2)); /* Ref is 1 */
  eo_ref(obj); /* Ref is 2 */
  eo_do(obj, eo_parent_set(NULL)); /* Ref is 1, giving the ref to NULL */
  eo_do(obj, eo_parent_set(parent)); /* Ref is 1 */

This is following a discussion on the ML about commit
8689d54471.

@feature
2015-08-26 10:11:18 +01:00
Tom Hacohen 93ade6f4ce Eo base: clean up parent removal in destructor.
This cleans up the changes in 8689d54471.
This commit reduces code duplication, and fixes broken handling of
overridden parent_set().
2015-08-21 17:23:13 +01:00
Carsten Haitzler a6c184502e eo - use ren not xref for children to not waste memory
optimization

xrefs keep lists of objects references. children are already in a list.
why keep both? lots of extra memory used for no value when debug is on
(pretty much most of the time).
2015-08-20 19:41:47 +09:00
Carsten Haitzler 8689d54471 eo - destruction - ensure child is removed from parent child list
this follows on from cbc1a217bf as this
code was correct, but was then causing bugs due to children staying in
their parent lists. this should never have happened and this is really
bad. this fixes this and ensures children on destruction are gone from
their parent lists.

@fix
2015-08-20 12:53:53 +09:00
Carsten Haitzler cbc1a217bf eo - fix bug vector when unparenting of an eo obj may affect others
it is possible that a destructor/parent_set override or function could
go modifying the children list of objects in a parent, this the
EINA_LIST_FREE may actually miss objects in the process since within
the "free" func the list may have been altered etc.

@fix
2015-08-18 17:23:16 +09:00
Tom Hacohen 52d998f475 Eo base: Remove the free_func parameter from key_data_set.
This was not really useful and against the Eolian guidelines.
While I promised I won't break things until the 27th, I was ill
(still am), so I'm giving myself a 1 day pass. :P
2015-05-28 17:47:59 +01:00
Tom Hacohen 92fb2917cb Eo: Remove eo_error_set() and clean up finalizer()
This is another cleanup in perparation for the Eo stable release.
This is no longer needed thanks to the proper error reporting with
eo_constructor()'s new return value.

The finalizer change cleans it up a bit so it catches more cases/issues.
This also means that the finalizer cleans up the object in all cases,
and not only some.

@feature.
2015-05-20 16:25:38 +01:00
Tom Hacohen 6efbfe227a Eo: Add a return value to eo_constructor().
From now on, constructors should return a value, usually the object
being worked on, or NULL (if the constructor failed). This can also
be used for implementing singletons, by just always returning the same
object from the constructor.

This is one of the final steps towards stabilizing Eo.

@feature
2015-05-20 13:03:24 +01:00
Tom Hacohen e27f40111d Eo: Mark composite APIs as beta.
Until now we used @protected, but now we can finally properly use @beta.
2015-05-08 16:18:36 +01:00
Tom Hacohen 1506ec30ba Eo base: mark composite API as not ready. 2015-05-06 15:46:18 +01:00
Tom Hacohen a791d97bfc Eo: Remove GCCism and make it more portable.
This affects eo_do() and eo_add() that used to use the ({}) GCCism.
Following a discussion with Peter de Ridder after my talk at FOSDEM,
we've decided to reopen the GCCism (works with other gcc compatible
compilers like clang and intelc) discussion, and after a bit of back and
forth it was decided to make things more portable, at the cost of ease
of use.

For example:
if (eo_do(obj, visible_get()))
is no longer allowed, the portable alternative
Eina_Bool tmp;
if (eo_do_ret(obj, tmp, visible_get()))
is to be used instead.

However:
eo_do(obj, a = a_get(), b = b_get(), bool_set(!bool_get))
are still allowed and OK.

eo_do(obj, if (a_get()) return;);
is no longer allowed, but:
eo_do(obj, if (a_get()) something());
is still allowed.

For clarity, this commit only incorporates the Eo changes, and not the
EFL changes to make the efl conform with this change.

Thanks again to Peter de Ridder for triggering this important discussion
which led to this change.
2015-02-23 17:16:02 +00:00
Tom Hacohen 01a487d881 Eo composite: Fix composite object functions to be eo functions.
For some reason, they were normal functions instead of eo functions,
which makes them harder to bind, less safe, and just wrong.
This commit fixes that.
2014-10-21 12:37:00 +01:00
Tom Hacohen 2a0937b889 Eo base: Add a property to indicate if the object is finalized;
This enables checking if an object is being created, or has already been
finalized. This is useful in functions that you want to allow
only during the creation phase (i.e inside the eo_add()).
2014-08-29 10:26:23 +01:00
Tom Hacohen ab38ffd6ed Eo base: Fix marking of eolian functions with EOLIAN. 2014-07-24 15:35:00 +01:00
Tom Hacohen 490eebabea Eo base: Mark class methods.
Use the new @class attribute to mark class methods.
2014-07-24 15:35:00 +01:00
Cedric BAIL 3dcc172f57 eo: make parent_set a O(1) operation instead of O(n).
This does impact performance quite significantly when you have a lot
of children.
2014-07-06 13:15:21 +02:00
Tom Hacohen 6eb3bda426 Eo base: Start generating eo_base from the .eo file. 2014-06-03 11:28:02 +01:00
Tom Hacohen d9263e6571 Eo base: rename event_freeze_get to event_freeze_count_get.
This is needed because of a possible clash between the method event_freeze
and the property event_freeze with bindings.
2014-06-02 12:50:23 +01:00
Tom Hacohen f92e5d50f9 Eo: Add eo_finalize. A func that's called at the end of eo_add.
This function lets you hook at the end of eo_add and override it for a
class. This is essentially the first step towards killing custom
constructors. Instead of having a custom constructor, you should just
do:
eo_add(CLASS, parent, a_set(3), b_set("eou"));
eo_constructor is called at the beginning for pre-init things.
eo_finalize is called at the end, for actually finalizing and doing
things. This cleans up the API and possibly saves a lot of things that
would have been stupid and slow in the past, like loading an elm widget
with an existing theme, and then changing the theme.

** This breaks Eo ABI, please recompile elementary and everything else that
creates eo objects.

@feature
2014-05-30 11:22:36 +01:00
Tom Hacohen 1e1104584f Eo legacy events: Add missing addition to hash table.
This rendered the whole thing useless.

Found thanks to coverity.
CID 1216616
CID 1216617
2014-05-29 09:24:28 +01:00
Tom Hacohen 50a6e371a1 Eo: Support mixing legacy and non-legacy callbacks. 2014-05-28 12:28:18 +01:00
Tom Hacohen c58b3401c3 Eo/evas events: Move legacy events dynamic generator to eo. 2014-05-28 12:28:17 +01:00
Tom Hacohen cdea54dd40 Eo callbacks: Fix a possible issue of corrupted callback list.
This happens when we delete more than one callback at the beginning
of the list (i.e 2 or more) in one go.
2014-05-16 14:33:36 +01:00
Tom Hacohen ecc445b47c Eo: Don't write to pointer after free.
Fixes coverity: CID 1039898.
2014-05-16 14:33:36 +01:00
Tom Hacohen 9b265b0065 Revert "Eo: Fix deref after free."
Coverity found the issue, but it's an issue we've already fixed in the
past. I don't know how it got lost, but it seems like someone did a bad
merge. Probably when migrating to Eo2.

This reverts commit 831c20464d.
2014-05-16 14:33:00 +01:00
Tom Hacohen 831c20464d Eo: Fix deref after free.
In some rare cases it was possible for a pointer to be referenced after
it was already freed. This is now fixed thanks to coverity.

@fix

CID 1039898
2014-05-16 14:28:57 +01:00
Tom Hacohen 1fe084b78c Eo: Made some functions class functions again.
This broke in the transition to Eo2.
2014-05-01 13:58:27 +01:00
Lukasz Stanislawski 80b1ca8e43 eo: fix broken children iterator, remove redundant fields.
@fix

Summary: Tests added.

Reviewers: raster, JackDanielZ, tasn

CC: cedric

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

Signed-off-by: Cedric Bail <cedric.bail@free.fr>
2014-04-17 19:36:12 +02:00
Tom Hacohen 8c025ee4d9 Eo: Renamed eo files from eo2* to eo*. 2014-04-10 04:20:21 +01:00
Tom Hacohen 3c46e7dab8 Eo2: Removed a lot of Eo1 code. 2014-04-10 04:20:21 +01:00
Jérémy Zurcher 2490a1bef2 eo2: better op_descs integration
struct _Eo_Class_Description swallows
Eo2_Op_Description *descs2;
2014-04-10 04:20:15 +01:00
Jérémy Zurcher f05f51dd60 eo2: _Eo_Class_Description swallows op_descs
remove OpDescs argument from macros,
eo2_get_op_id() uses binary search
2014-04-10 04:20:15 +01:00
Tom Hacohen c5af1a7305 Eo: Add an error message when old parent is wrong.
This is an addition to raster's fix in
55d8156414
(eo - base class protection against NULL old_parent_pd)
2013-11-26 10:10:24 +00:00
Carsten Haitzler 55d8156414 eo - base class protection against NULL old_parent_pd
bug T569 still shows that we have cases where, during e shutdown, we
still get eo_data_scope_get() return NULL for a parent object.
whatever this is, segfaulting is much worse than protecting and
marching on. so protect
2013-11-26 17:03:50 +09:00
Tom Hacohen cad3cf30a4 Eo: Check parent is valid in eo_parent_set.
This is an extension to raster's 0355a6a296
(eo - fix _parent_set in base clase when old_parent_pd is NULL).
I also added an error message in case this check fails.
2013-11-20 12:23:18 +00:00
Carsten Haitzler 0355a6a296 eo - fix _parent_set in base clase when old_parent_pd is NULL
this should fix T538
2013-11-20 20:25:33 +09:00
Tom Hacohen a52751d065 Eo: Fixed potential infinite loop with child deletion.
It looks like it should get into a loop for every object that has
children.
2013-11-08 12:11:27 +00:00
Tom Hacohen c7addf4083 Changed Eo class names to be consistent.
All the class names are now of the format: Lib_Type_Subtype_Extra.
2013-11-07 11:17:52 +00:00
Carsten Haitzler 69e27abdc3 eina - and e3fl in general - stop using eina_error_get/set - useless really 2013-10-11 16:50:40 +09:00
Cedric Bail 435caae51a eo: use Eina_Spinlock instead of Eina_Lock.
This is an ABI/API break for Eo, you will need to rebuild everything that use Eo.
2013-10-11 11:08:17 +09:00
Tom Hacohen 104a57b58a Eo callbacks: Fix a possible issue of corrupted callback list.
This happens when we delete more than one callback at the beginning
of the list (i.e 2 or more) in one go.
2013-09-30 14:16:46 +01:00
Tom Hacohen f5d4a807c8 Eo: Don't write to pointer after free.
Fixes coverity: CID 1039898.
2013-09-30 14:15:37 +01:00
Daniel Zaoui 334ac705f3 Eo: fix when detaching the composite of its parent ... that has to exist 2013-09-29 08:50:32 +03:00
Tom Hacohen 832fc5b5ce Manually revert "eo: replace Eo_Class with Eo"
This reverts commit ee1b0833ed

I did it manually because the code changed too much.

We actually want this type, it makes things more clear and easier to
understand.
2013-09-27 16:40:32 +01:00
Tom Hacohen 2a82ff95e4 Eo: unify the class func and normal func prototypes.
Conflicts:
	src/lib/eo/eo.c
2013-09-27 14:01:47 +01:00
Jérémy Zurcher 41bd91379e eo: _Eo -> _Eo_Object
Conflicts:
	src/lib/eo/eo.c
2013-09-27 14:01:46 +01:00
Jérémy Zurcher ee1b0833ed eo: replace Eo_Class with Eo 2013-09-27 14:01:46 +01:00
Cedric Bail 936a8072f2 eo: make eo_parent_get/set part of eo_base_class. 2013-09-25 13:34:18 +09:00
Cedric Bail cecd19803e eo: let's handle memory allocation gracefully. 2013-07-16 20:03:48 +09:00
Cedric Bail 166e89baac Revert "eo: try to fix callback array to work on other system."
This reverts commit e89f32d28d.
2013-07-16 15:18:16 +09:00
Cedric Bail ebb36c98a8 eo: micro optimization speed up callback call by 3%. 2013-07-16 13:45:36 +09:00
Cedric Bail e89f32d28d eo: try to fix callback array to work on other system. 2013-07-16 13:41:27 +09:00
Cedric Bail cb5dbb55c3 eo: reporting error here just make the caller code more complex for nothing valuable. 2013-07-05 10:18:19 +09:00
Cedric Bail cc012b754c eo: little micro optimization. 2013-07-01 18:35:55 +09:00
Cedric Bail dcf65a8eec eo: add a new macro to make the code easier to read and use it. 2013-06-28 15:28:30 +09:00
Cedric Bail 7849c5de32 eo: 30% speed improvement in message propagation. 2013-06-28 10:18:39 +09:00
Tom Hacohen 6e3f555fe4 Eo: Made del event an hot event (we always want to get it). 2013-05-21 15:07:41 +01:00
Cedric Bail 1db92f9ac0 eo: some event should not be frozen. 2013-05-20 18:17:29 +09:00
Daniel Willmann 7f87d9891d eo: Fix incorrect pointer allocation
We want to allocate sizeof(Eo_Dbg_Info) - not sizeof(Eo_Dbg_Info *)
bytes.
2013-04-24 23:27:48 +01:00
Tom Hacohen 269e3a7797 Eo: Fixed an error in in _eo_callback_remove and a few minor things.
The other things are not really issues but more about silencing clang.
Thanks to clang-analyzer.
2013-04-12 17:17:38 +01:00
Tom Hacohen 263e54d705 Eo: Moved the debug info functions to the base class code. 2013-04-12 13:49:26 +01:00
Tom Hacohen 3e11c380c9 Eo: Added eo_event_callback_array_* functions.
These functions let you pass an array of callbacks instead of just one.
It's more memory efficient to use this if you just add a bulk of events
on the same object.

This commits breaks ABI, and breaks API of the EO_EV_CALLBACK_ADD/DEL
signals (the event info passed).
2013-04-12 12:02:49 +01:00
Tom Hacohen 45fdd4574e Eo base: Reduce object memory footprint. 2013-04-11 17:04:42 +01:00
Tom Hacohen c226a11bfe Eo callbacks: Improve memory footprint of callbacks.
We don't really need a double-linked-list with a pointer to the last item.
This saves us 2 pointers per callback, which is a decent improvement.
2013-04-11 15:07:07 +01:00
Aharon Hillel 028f059d32 Clouseau-Eo integration: Added debug info functions.
From now, classes implementing the Eo function with id
EO_BASE_SUB_ID_DBG_INFO_GET will be able to show in Clouseau their own
specific information.
Information contents is controlled by the class itself and no more
by Clouseau. Basic types and lists are supported..

Signed-off-by: Aharon Hillel <a.hillel@samsung.com>

SVN revision: 83410
2013-01-29 06:36:23 +00:00
Vincent Torri 3b5a3448b7 merge: add eo
SVN revision: 77072
2012-09-26 06:56:52 +00:00