On Sat, Mar 1, 2014 at 2:18 AM, Daniel Juyung Seo <[email protected]> wrote: > On Thu, Feb 27, 2014 at 11:46 PM, Gustavo Sverzut Barbieri < > [email protected]> wrote: > >> On Wed, Feb 26, 2014 at 10:36 PM, WooHyun Jung <[email protected]> >> wrote: >> > woohyun pushed a commit to branch master. >> > >> > >> http://git.enlightenment.org/core/efl.git/commit/?id=6093e68cb01cf915057b9e330f7586039d092990 >> > >> > commit 6093e68cb01cf915057b9e330f7586039d092990 >> > Author: WooHyun Jung <[email protected]> >> > Date: Thu Feb 27 10:31:42 2014 +0900 >> > >> > evas: replace EINA_LIST_FREE to EINA_LIST_FOREACH_SAFE. >> > >> > EINA_LIST_FREE does eina_list_remove_list, and clip_unset does >> > the same thing to the same list pointer. So, EINA_LIST_FOREACH_SAFE >> > is proper for this case. >> > --- >> > src/lib/evas/canvas/evas_object_main.c | 2 +- >> > 1 file changed, 1 insertion(+), 1 deletion(-) >> > >> > diff --git a/src/lib/evas/canvas/evas_object_main.c >> b/src/lib/evas/canvas/evas_object_main.c >> > index 9db95d4..d8d3850 100644 >> > --- a/src/lib/evas/canvas/evas_object_main.c >> > +++ b/src/lib/evas/canvas/evas_object_main.c >> > @@ -654,7 +654,7 @@ _destructor(Eo *eo_obj, void *_pd, va_list *list >> EINA_UNUSED) >> > goto end; >> > } >> > evas_object_grabs_cleanup(eo_obj, obj); >> > - EINA_LIST_FREE(obj->clip.clipees, tmp) >> > + EINA_LIST_FOREACH_SAFE(obj->clip.clipees, l, l2, tmp) >> > evas_object_clip_unset(tmp->object); >> >> if that's the case then a saner approach is to NULL obj->clip.clipees >> and then iterate the list: >> >> l = obj->clip.clipees; >> obj->clip.clipees = NULL; >> EINA_LIST_FREE(l, tmp) >> evas_object_clip_unset(tmp->obj) >> >> of course you may have to clear tmp and whatever is needed to do here as >> well. >> >> >> the solution above is simpler and should be faster than your solution >> using the foreach-safe version. >> >> > Dear Barbieri, > thanks for the suggestion. > > But when I look at the evas_object_clip_unset(), it looks like your > approach has no benefit. > https://git.enlightenment.org/core/efl.git/tree/src/lib/evas/canvas/evas_clip.c#n400 > In line number 401, if "obj->cur->clipper->clip.clipees" is NULL, it will > trigger the following codes. > > if (!obj->cur->clipper->clip.clipees) > { > EINA_COW_STATE_WRITE_BEGIN(obj->cur->clipper, state_write, cur) > { > state_write->have_clipees = 0; > } > EINA_COW_STATE_WRITE_END(obj->cur->clipper, state_write, cur); > > if ((obj->cur->clipper->cur) && (obj->cur->clipper->cur->visible)) > { > if (obj->cur->clipper->layer) > { > Evas_Public_Data *e = obj->cur->clipper->layer->evas; > evas_damage_rectangle_add(e->evas, > obj->cur->clipper->cur->geometry.x > + e->framespace.x, > obj->cur->clipper->cur->geometry.y > + e->framespace.y, > obj->cur->clipper->cur->geometry.w, > > obj->cur->clipper->cur->geometry.h); > } > } > } > > So Woohyun's approach looks ok to me. > > evas_object_image_source_unset() does the same thing. > So the current code looks like: > EINA_LIST_FOREACH_SAFE(obj->clip.clipees, l, l2, tmp) > evas_object_clip_unset(tmp->object); > EINA_LIST_FOREACH_SAFE(obj->proxy->proxies, l, l2, proxy) > evas_object_image_source_unset(proxy); > > https://git.enlightenment.org/core/efl.git/tree/src/lib/evas/canvas/evas_object_main.c#n659 > > How do you think?
I think that we should have a private version that doesn't do what is being done right now that is shared between the "cleanup/destructor" version we're doing and the actual clip_unset(). The clip_unset() version would still have the code you listed, the cleanup wouldn't. Of course we shouldn't be executing the have_clipees or adding damage rect if we're going to die. But we shouldn't be going thru eo or all those checks anyway. same applies to source_unset(). -- Gustavo Sverzut Barbieri -------------------------------------- Mobile: +55 (19) 9225-2202 Contact: http://www.gustavobarbieri.com.br/contact ------------------------------------------------------------------------------ Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce. With Perforce, you get hassle-free workflows. Merge that actually works. Faster operations. Version large binaries. Built-in WAN optimization and the freedom to use Git, Perforce or both. Make the move to Perforce. http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk _______________________________________________ enlightenment-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
