[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [E-devel] Ecore_List bugs



On Sun, Jul 30, 2006 at 08:10:09PM +0200, Simon TRENY wrote:
> Hi there,
> 
> I notice some "bugs" (or strange behaviour) in the calling policy of
> the free-callback in Ecore_List:
> - If you call ecore_list_destroy(), the free-callback will indeed be
> called on all the elements.
> - If you call ecore_list_clear(), the free_cb won't be called.
> - ecore_list_remove() doesn't call the free_cb neither. Ok, there is
> ecore_list_remove_destroy(), but I just find it really confusing. When
> you set a free_cb, you usually want it to be called when you remove an
> element.

It makes sense to me to have two sets of list removal calls. Often, you
add/remove objects that are used elsewhere to/from lists, so removing
them from the list doesn't at all correspond to deleting them. (i.e. no
free necessary). But, I haven't used ecore lists much. I guess you just wouldn't set a free callback for lists of such items. So, perhaps a bit confusing.

Also, I noticed that _destroy() frees the list itself (in addition to
the items). The header file make it look like that's the only difference
between _clear() and _destroy(). So you're probably right that _clear()
should call the item free callback.
--
rephorm