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

David Anes david.anes at gmail.com
Tue Sep 16 12:11:47 EDT 2008


I've been using MonoDevelop.Components.DockToolbars in a personal
project and I get random errors when closing my application ( just
after calling Gtk.Application.Quit() ):

Exception in Gtk# callback delegate
  Note: Applications can use GLib.ExceptionManager.UnhandledException
to handle the exception.
System.InvalidOperationException: List has changed.
  at System.Collections.ArrayList+SimpleEnumerator.MoveNext () [0x00000]
  at MonoDevelop.Components.DockToolbars.FixedPanel.ForAll (Boolean
include_internals, Gtk.Callback callback) [0x0001d] in
  at Gtk.Container.Forall_cb (IntPtr container, Boolean
include_internals, IntPtr cb, IntPtr data) [0x00000]
   at GLib.ExceptionManager.RaiseUnhandledException(System.Exception
e, Boolean is_terminal)
   at Gtk.Container.Forall_cb(IntPtr container, Boolean
include_internals, IntPtr cb, IntPtr data)
   at Gtk.Container.Forall_cb(IntPtr , Boolean , IntPtr , IntPtr )
   at Gtk.Application.gtk_main()
   at Gtk.Application.gtk_main()
   at Gtk.Application.Run()

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?


David "kraptor" Anes Alcolea
-------------- next part --------------
A non-text attachment was scrubbed...
Name: forall.fixedpanel.diff
Type: text/x-diff
Size: 449 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/monodevelop-devel-list/attachments/20080916/88ccadc0/attachment.bin 

More information about the Monodevelop-devel-list mailing list