On Mon, Jan 19, 2009 at 9:15 PM, Vincent Torri <vtorri@...> wrote:
> On Mon, 19 Jan 2009, Gustavo Sverzut Barbieri wrote:
>>> about that bug, i think that the problem is that, line 191, we try to
>>> l->data while l is not available anymore.
>>> so maybe we can switch the lines 190 et 191 : free first l->data, then
>>> remove the list item l.
>>> what do you think ?
>> it is still wrong since l->next will be accessed right after that. You
>> need to move E_FREE() call before list removal and use proper
>> iteration, might be good use of my EINA_LIST_FOREACH_SAFE().
> I've already comitted it. I add a FIXME to say that it's not the correct
> fix. I don't know how to use EINA_LIST_FOREACH_SAFE().
check the docs in eina_list.h, should be easy to understand, it's a
drop-in replacement to EINA_LIST_FOREACH() but takes an extra variable
to pre-fetch the next pointer so if you remove the current node its
->next is already known. If you remove more than the current node
(hint: current->next), then you're screwed anyway :-) In this case
you must do it manually.
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
Mobile: +55 (19) 9225-2202