On 10/2/07, Enlightenment CVS <[EMAIL PROTECTED]> wrote:
>
> Log Message:
> Since Gustavo changed the order of EVAS_CALLBACK_FREE's event in
> evas_object_main.c, we have to call the model's custom free callback before
> we delete the object from the tree.
>
> This brings up a question though, will this hurt any other apps? If you add
> an EVAS_CALLBACK_FREE callback to an edje object that has a swallow part, and
> you want to free the swallowed object when the main edje object is deleted,
> you can no longer expect that to be done automatically on evas_object_del
> since your EVAS_CALLBACK_FREE will be called too late. Any comments?

In this case it should be written differently: just add a callback to
delete the swallowed object and that's it, no need to get the
swallowed part from the edje itself, something like:

do_add(...) {
   my_object_storage->swallowed_parts = NULL;
   evas_object_smart_callback_add(o, cb_swallow_free, my_object_storage);
}

do_swallow(...) {
   edje_object_part_swallow(edje, part, object);
   my_object_storage->swallowed_parts =
evas_list_append(my_object_storage->swallowed_parts, object);
}

do_unswallow(...) {
   edje_object_part_unswallow(edje, object);
   my_object_storage->swallowed_parts =
evas_list_remove(my_object_storage->swallowed_parts, object);
}

cb_swallow_free(...) {
   for (l = my_object_storage->swallowed_parts; l != NULL; l = l->next)
      evas_object_del(l->data);
}


If my_object_storage will be freed before cb_swallow_free() is called,
you can always malloc() the pointer to Evas_List* and use it, just
remember to free it in cb_swallow_free().


-- 
Gustavo Sverzut Barbieri
--------------------------------------
Jabber: [EMAIL PROTECTED]
   MSN: [EMAIL PROTECTED]
  ICQ#: 17249123
 Skype: gsbarbieri
Mobile: +55 (81) 9927 0010

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to