Andrea, The System.Timers.Timer class fires it's events from a thread other than the "GUI thread", which causes issues with GTK+. You should use GLib.Timeout.Add for this purpose.
See http://mono-project.com/Responsive_Applications for further information. -pete On Thu, Oct 07, 2010 at 08:43:55AM -0700, andrea wrote: > > I've build a really simple application using MonoDevelop 2.4 in OpenSuse > (using VMWare image downloaded from mono website). > > My window contains a fixed container with an Entry widget named "Entry1". > > Finally I modified autogenerated C# code in MainWindows.cs adding the > "bolded" code: > > using System; > using Gtk; > using System.Timers; > > public partial class MainWindow : Gtk.Window > { > Timer x=new Timer(); > > public MainWindow () : base(Gtk.WindowType.Toplevel) > { > Build (); > x.Elapsed+=tmrElapsed; > x.Interval=500; > x.Enabled=true; > } > > private void tmrElapsed (object sender, ElapsedEventArgs e) > { > entry1.Text=DateTime.Now.ToString(); > } > > protected void OnDeleteEvent (object sender, DeleteEventArgs a) > { > Application.Quit (); > a.RetVal = true; > } > } > > Finally I run it and I can see the window with the entry containing the > current date and time, but after 1 or 2 seconds the application crash > showing the trace attached .... > > What's wrong? > > Thanks in advance. http://mono.1490590.n4.nabble.com/file/n2967045/tmp.txt > tmp.txt > -- > View this message in context: > http://mono.1490590.n4.nabble.com/Simple-Gtk-window-crash-when-Entry-s-text-refreshed-via-a-timer-tp2967045p2967045.html > Sent from the Mono - Gtk# mailing list archive at Nabble.com. > _______________________________________________ > Gtk-sharp-list maillist - Gtk-sharp-list@lists.ximian.com > http://lists.ximian.com/mailman/listinfo/gtk-sharp-list > -- _______________________________________________ Gtk-sharp-list maillist - Gtk-sharp-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/gtk-sharp-list