On 14-Sep-2000 Chris Kuklewicz wrote:
> Ok...The browsermenu.cpp code for delete_sel had a small mistake.
>
> It used a forward iterator on the p->mbSelection vector of items, which
> were being deleted as it worked (apparantly by a callback in another thread
> in browsertree.cpp in ctree_unselected).
Ya. seems gtk's going into two callbacks at once, which it shouldn't be able
to do.
> So if you select alot of items and use the edit menu to remove them,
> the iterator "i" would become lost, and could wander past the end of
> the vector. Then (*i) would be null, which would be derefenced, and
> thus segfault.
>
> Most loops are reverse_iterators, which seems to fix this here. But I do
> not like this fix here since it seems too fragile.
The reverse_iterators are safe enough, just in this case I didn't want to
delete things backwards for some reason...
> The better solution is to avoid alot of threads mucking with the list
> at the same time. I am submitting a patch that creates a duplicate of
> the mbSelection list (or the m_plSelected list in the other case in
> delete_sel). The function can then iterate through this list without
> problems.
I applied the section pertinent to this particular case, and left out the rest.
If there's still problems in this section of code, I'll get em in, but for
now, I don't think the rest of the patches are necessary.
Isaac
_______________________________________________
[EMAIL PROTECTED]
http://www.freeamp.org/mailman/listinfo/freeamp-dev