On Thu, 20 Aug 2015 18:48:46 +0900 Carsten Haitzler (The Rasterman) <ras...@rasterman.com> said:
> we do have an issue still - up for discussion here. > > obj = eo_add(SIMPLE_CLASS, NULL); > obj2 = eo_add(SIMPLE_CLASS, obj); > > has obj2 at refcount of 1. as i would expect. BUT > > obj = eo_add(SIMPLE_CLASS, NULL); > obj2 = eo_add(SIMPLE_CLASS, NULL); > eo_do(obj2, eo_parent_set(obj); > > has obj2 having a refcount of 2. imho this is totally inconsistent. it's > surprising to the developer. unexpected. and that is bad. > > if you ask me the first case is better. if requires 1 less unref (and if we > are consistent then every time we create a child we have to remember to unref > every child all the time to ensure the parent can delete it). so from > programming convenience it makes code longer and far more likely to get leaks > when you forget to unref an obj you give to a parent. > > the other reason we should do case 1 in both situations in terms of refcount > is that conceptually, when you set parent, you are handing YOUR ref TO the > parent. logically you are transferring your ref. if its creation > (constructors etc.) or if its inside some callbacks that is moving an obj > from obj a to b the ref is being transferred. > > so i vote this get fixed. (dis)agreements? > anyone? everyone? people? -- ------------- Codito, ergo sum - "I code, therefore I am" -------------- The Rasterman (Carsten Haitzler) ras...@rasterman.com ------------------------------------------------------------------------------ _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel