Dnia niedziela, 26 kwietnia 2009, Michael Hutchinson napisaĆ:
>
> GTK+ isn't threadsafe; you can't safely touch GTK objects from other
> threads. There are a few ways to handle timers and calls from other
> threads:
> Gtk.Application.Invoke
> GLib.Timeout.Add
> GLib.Idle.Add
>
> See http://mono-project.com/Responsive_Applications for more info.
Thanks,
I've read this topic, but didn't realize, that signal received within the
Gtk.Application isn't thread safe.
The easiest way was (as I suppose) is:
if(Changed != null)
Gtk.Application.Invoke(delegate { Changed("u"); });
or catch the signal in MainWindow.OnChanged() and execute second function (or
code) with G.A.Invoke.
The second approach is, as I think, more correct, because it does not make
Thread class Gtk dependent. The first is "write and forget" - You don't have to
remember about G.A.Invoke and writing delegates.
Regards,
Piotr
_______________________________________________
Gtk-sharp-list maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list