зеркало из https://github.com/mono/mail-archives.git
125 строки
5.3 KiB
HTML
125 строки
5.3 KiB
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
||
|
<HTML>
|
||
|
<HEAD>
|
||
|
<TITLE> [Gtk-sharp-list] Simple Gtk window crash when Entry's text refreshed via a timer
|
||
|
</TITLE>
|
||
|
<LINK REL="Index" HREF="index.html" >
|
||
|
<LINK REL="made" HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20Simple%20Gtk%20window%20crash%20when%20Entry%27s%0A%09text%09refreshed%20via%20a%20timer&In-Reply-To=1286466235189-2967045.post%40n4.nabble.com">
|
||
|
<META NAME="robots" CONTENT="index,nofollow">
|
||
|
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
|
||
|
<LINK REL="Previous" HREF="010533.html">
|
||
|
<LINK REL="Next" HREF="010536.html">
|
||
|
</HEAD>
|
||
|
<BODY BGCOLOR="#ffffff">
|
||
|
<H1>[Gtk-sharp-list] Simple Gtk window crash when Entry's text refreshed via a timer</H1>
|
||
|
<B>Peter Johanson</B>
|
||
|
<A HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20Simple%20Gtk%20window%20crash%20when%20Entry%27s%0A%09text%09refreshed%20via%20a%20timer&In-Reply-To=1286466235189-2967045.post%40n4.nabble.com"
|
||
|
TITLE="[Gtk-sharp-list] Simple Gtk window crash when Entry's text refreshed via a timer">peter at peterjohanson.com
|
||
|
</A><BR>
|
||
|
<I>Thu Oct 7 11:57:42 EDT 2010</I>
|
||
|
<P><UL>
|
||
|
<LI>Previous message: <A HREF="010533.html">[Gtk-sharp-list] Simple Gtk window crash when Entry's text refreshed via a timer
|
||
|
</A></li>
|
||
|
<LI>Next message: <A HREF="010536.html">[Gtk-sharp-list] Simple Gtk window crash when Entry's text refreshed via a timer
|
||
|
</A></li>
|
||
|
<LI> <B>Messages sorted by:</B>
|
||
|
<a href="date.html#10534">[ date ]</a>
|
||
|
<a href="thread.html#10534">[ thread ]</a>
|
||
|
<a href="subject.html#10534">[ subject ]</a>
|
||
|
<a href="author.html#10534">[ author ]</a>
|
||
|
</LI>
|
||
|
</UL>
|
||
|
<HR>
|
||
|
<!--beginarticle-->
|
||
|
<PRE>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 <A HREF="http://mono-project.com/Responsive_Applications">http://mono-project.com/Responsive_Applications</A> for further
|
||
|
information.
|
||
|
|
||
|
-pete
|
||
|
|
||
|
On Thu, Oct 07, 2010 at 08:43:55AM -0700, andrea wrote:
|
||
|
><i>
|
||
|
</I>><i> I've build a really simple application using MonoDevelop 2.4 in OpenSuse
|
||
|
</I>><i> (using VMWare image downloaded from mono website).
|
||
|
</I>><i>
|
||
|
</I>><i> My window contains a fixed container with an Entry widget named "Entry1".
|
||
|
</I>><i>
|
||
|
</I>><i> Finally I modified autogenerated C# code in MainWindows.cs adding the
|
||
|
</I>><i> "bolded" code:
|
||
|
</I>><i>
|
||
|
</I>><i> using System;
|
||
|
</I>><i> using Gtk;
|
||
|
</I>><i> using System.Timers;
|
||
|
</I>><i>
|
||
|
</I>><i> public partial class MainWindow : Gtk.Window
|
||
|
</I>><i> {
|
||
|
</I>><i> Timer x=new Timer();
|
||
|
</I>><i>
|
||
|
</I>><i> public MainWindow () : base(Gtk.WindowType.Toplevel)
|
||
|
</I>><i> {
|
||
|
</I>><i> Build ();
|
||
|
</I>><i> x.Elapsed+=tmrElapsed;
|
||
|
</I>><i> x.Interval=500;
|
||
|
</I>><i> x.Enabled=true;
|
||
|
</I>><i> }
|
||
|
</I>><i>
|
||
|
</I>><i> private void tmrElapsed (object sender, ElapsedEventArgs e)
|
||
|
</I>><i> {
|
||
|
</I>><i> entry1.Text=DateTime.Now.ToString();
|
||
|
</I>><i> }
|
||
|
</I>><i>
|
||
|
</I>><i> protected void OnDeleteEvent (object sender, DeleteEventArgs a)
|
||
|
</I>><i> {
|
||
|
</I>><i> Application.Quit ();
|
||
|
</I>><i> a.RetVal = true;
|
||
|
</I>><i> }
|
||
|
</I>><i> }
|
||
|
</I>><i>
|
||
|
</I>><i> Finally I run it and I can see the window with the entry containing the
|
||
|
</I>><i> current date and time, but after 1 or 2 seconds the application crash
|
||
|
</I>><i> showing the trace attached ....
|
||
|
</I>><i>
|
||
|
</I>><i> What's wrong?
|
||
|
</I>><i>
|
||
|
</I>><i> Thanks in advance. <A HREF="http://mono.1490590.n4.nabble.com/file/n2967045/tmp.txt">http://mono.1490590.n4.nabble.com/file/n2967045/tmp.txt</A>
|
||
|
</I>><i> tmp.txt
|
||
|
</I>><i> --
|
||
|
</I>><i> View this message in context: <A HREF="http://mono.1490590.n4.nabble.com/Simple-Gtk-window-crash-when-Entry-s-text-refreshed-via-a-timer-tp2967045p2967045.html">http://mono.1490590.n4.nabble.com/Simple-Gtk-window-crash-when-Entry-s-text-refreshed-via-a-timer-tp2967045p2967045.html</A>
|
||
|
</I>><i> Sent from the Mono - Gtk# mailing list archive at Nabble.com.
|
||
|
</I>><i> _______________________________________________
|
||
|
</I>><i> Gtk-sharp-list maillist - <A HREF="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">Gtk-sharp-list at lists.ximian.com</A>
|
||
|
</I>><i> <A HREF="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">http://lists.ximian.com/mailman/listinfo/gtk-sharp-list</A>
|
||
|
</I>><i>
|
||
|
</I>
|
||
|
--
|
||
|
|
||
|
</PRE>
|
||
|
|
||
|
|
||
|
|
||
|
<!--endarticle-->
|
||
|
<HR>
|
||
|
<P><UL>
|
||
|
<!--threads-->
|
||
|
<LI>Previous message: <A HREF="010533.html">[Gtk-sharp-list] Simple Gtk window crash when Entry's text refreshed via a timer
|
||
|
</A></li>
|
||
|
<LI>Next message: <A HREF="010536.html">[Gtk-sharp-list] Simple Gtk window crash when Entry's text refreshed via a timer
|
||
|
</A></li>
|
||
|
<LI> <B>Messages sorted by:</B>
|
||
|
<a href="date.html#10534">[ date ]</a>
|
||
|
<a href="thread.html#10534">[ thread ]</a>
|
||
|
<a href="subject.html#10534">[ subject ]</a>
|
||
|
<a href="author.html#10534">[ author ]</a>
|
||
|
</LI>
|
||
|
</UL>
|
||
|
|
||
|
<hr>
|
||
|
<a href="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">More information about the Gtk-sharp-list
|
||
|
mailing list</a><br>
|
||
|
</body></html>
|