[Mono-bugs] [Bug 387693] New: two Application.Run() loop does not finish after Form. Close()
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Wed May 7 07:45:48 EDT 2008
https://bugzilla.novell.com/show_bug.cgi?id=387693
User atsushi at ximian.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=387693#c325033
Summary: two Application.Run() loop does not finish after
Form.Close()
Product: Mono: Class Libraries
Version: SVN
Platform: i586
OS/Version: openSUSE 10.3
Status: NEW
Severity: Normal
Priority: P5 - None
Component: Windows.Forms
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: atsushi at ximian.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
The following code, based on #325033 but without Timer, exposes a bug inside
Application.Run() that the method keeps waiting for certain message:
--------
using System;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
class MainForm : Form
{
public MainForm ()
{
Load += new EventHandler (MainForm_Load);
}
static void Main ()
{
Application.Run (new MainForm ());
//Application.Run (new SplashForm ());
}
void MainForm_Load (object sender, EventArgs e)
{
Thread t = new Thread (new ThreadStart (Run));
t.IsBackground = true;
Console.WriteLine ("1: " + Thread.CurrentThread.GetHashCode ());
t.Start ();
Console.WriteLine ("1-2: " + Thread.CurrentThread.GetHashCode ());
t.Join ();
Console.WriteLine ("1-3: " + Thread.CurrentThread.GetHashCode ());
Close ();
Console.WriteLine ("1-4: " + Thread.CurrentThread.GetHashCode ());
}
static void Run ()
{
Console.WriteLine ("2: " + Thread.CurrentThread.GetHashCode ());
Application.Run (new SplashForm ());
Console.WriteLine ("2-2: " + Thread.CurrentThread.GetHashCode ());
}
}
class SplashForm : Form
{
public SplashForm ()
{
Button b = new Button ();
b.Click += delegate (object o, EventArgs e) {
Button_Click (o, e);
};
Controls.Add (b);
}
void Button_Click (object sender, EventArgs e)
{
Close ();
Console.WriteLine ("4: " + Thread.CurrentThread.GetHashCode ());
}
}
--------
It stops printing debug strings after "4: 2" (or something other than "2").
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list