[Mono-bugs] [Bug 75884][Cos] Changed - Form updated from an external thread doesn't redraw.

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Oct 7 08:57:59 EDT 2005


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by skolima at gmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=75884

--- shadow/75884	2005-10-06 21:10:15.000000000 -0400
+++ shadow/75884.tmp.19977	2005-10-07 08:57:59.000000000 -0400
@@ -1,19 +1,19 @@
 Bug#: 75884
 Product: Mono: Class Libraries
 Version: 1.1
 OS: unknown
-OS Details: Slackware 10.1
-Status: RESOLVED   
-Resolution: NOTABUG
+OS Details: mono-bugs at ximian.com
+Status: REOPENED   
+Resolution: 
 Severity: Unknown
 Priority: Cosmetic
 Component: Windows.Forms
 AssignedTo: jackson at ximian.com                            
 ReportedBy: skolima at gmail.com               
-QAContact: mono-bugs at ximian.com
+QAContact: jackson at ximian.com
 TargetMilestone: ---
 URL: 
 Cc: 
 Summary: Form updated from an external thread doesn't redraw.
 
 Description of Problem:
@@ -87,6 +87,65 @@
 to work when you run it, but thats more of a lucky timing thing.
 According to the docs you shouldn't be accessing your control from
 another thread except with the BeginInvoke stuff. 
 
 ------- Additional Comments From jackson at ximian.com  2005-10-06 21:10 -------
 Yeah this isn't legal look at using Control::BeginInvoke
+
+------- Additional Comments From skolima at gmail.com  2005-10-07 08:57 -------
+I did check, and indeed, the code wasn't legal. However, the problem
+persists after correcting it.
+
+Corrected code:
+
+using System;
+using System.Windows.Forms;
+using System.Threading;
+
+public class main
+{
+	public static void Main()
+	{
+		form test = new form();
+		Thread.Sleep(1000);
+		
+		delegt = new DoSth(test.doSth);
+		IAsyncResult ar = delegt.BeginInvoke("some text",null,null);
+		delegt.EndInvoke(ar);
+		
+		Thread.Sleep(1000);
+		
+		closet = new CloseIt(test.Close);
+		ar = closet.BeginInvoke(null,null);
+		closet.EndInvoke(ar);
+	}
+	protected static DoSth delegt;
+	protected static CloseIt closet;
+}
+
+public class form : Form
+{
+	protected ListBox listBox1;
+	public form()
+	{
+		listBox1 = new ListBox();
+		Controls.Add(listBox1);
+		
+		Thread t =  new Thread(new ThreadStart(threadProc));
+		t.IsBackground = true;
+		t.Start();
+	}
+	
+	protected void threadProc()
+		{
+			ShowDialog();
+		}
+	public void doSth(string what)
+	{
+		listBox1.Items.Add(what);
+		listBox1.Refresh();
+	}
+}
+public delegate void DoSth(string what);
+public delegate void CloseIt();
+
+The result is still the same...


More information about the mono-bugs mailing list