[Monodevelop-devel] Potential crash when using MonoDevelop.Components.DockToolbars

Mike Kestner mkestner at gmail.com
Tue Sep 16 13:27:40 EDT 2008


On Tue, 2008-09-16 at 18:11 +0200, David Anes wrote:

> Seems that a callback in the ForAll method modifies the "widgets"
> ArrayList. To prevent this, I've used the attached patch, that creates
> an in-memory copy of the ArrayList so it can be iterated safely.
> 
> Do not know if is correct or not, but I have no crashes anymore and
> all works as expected.
> 
> Any ideas why this happens?

Thanks for the patch.  I committed a fix based on your idea on r113192.
The problem is most likely that a Remove is being done in a Forall loop
during cleanup which is invalidating the arraylist underneath it.

The iteration definitely needs to be robust enough to continue across
such operations, so a clone of the list was needed.

Thanks again,
Mike



More information about the Monodevelop-devel-list mailing list