[Gtk-sharp-list] Thread-safe GUI update

Michael Hutchinson m.j.hutchinson at gmail.com
Sun Mar 25 07:33:40 EDT 2007


On 3/24/07, William Garrison <gtk at mobydisk.com> wrote:
> Wouldn't using a regular delegate eliminate this issue?  It would copy
> msg onto the stack for the call so the value wouldn't be overwritten
> during the next loop.  (I'm not sure if this code is quite right, but
> you get the idea)
>
> while (Messages.Count > 0) {
>     msg = (Message) Messages.Dequeue();
>     send(msg);
>     Gtk.Application.Invoke(AppendAValue,msg);
>     Thread.Sleep(0);
> }
>
> private void AppendAValue(Message msg)
> {
>     treeStore.AppendAvlues(msg.To, msg.Text);
> }

Yes, that would probably work.

-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Gtk-sharp-list mailing list