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

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Aug 23 10:10:17 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-08-23 10:10:17.000000000 -0400
+++ shadow/75884.tmp.28787	2005-08-23 10:10:17.000000000 -0400
@@ -0,0 +1,83 @@
+Bug#: 75884
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: Slackware 10.1
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Cosmetic
+Component: Windows.Forms
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: skolima at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Form updated from an external thread doesn't redraw.
+
+Description of Problem:
+
+In a console app, I create a sepparate thread to handle the message loop of
+a form. After main thread does some changes to form's contents, it calls
+Refresh/Invalidate/Update to force form's redraw. This works as expected on
+Microsoft.Net on Windows, but does not work neither on mono nor ilrun
+(0.7.0/0.7.2) on Linux, no matter what compiler is used.
+
+Steps to reproduce the problem:
+1. Code :
+
+using System;
+using System.Windows.Forms;
+using System.Threading;
+
+public class main
+{
+	public static void Main()
+	{
+		form test = new form();
+		Thread.Sleep(1000);
+		test.listBox1.Items.Add("some text");
+		test.listBox1.Refresh();
+		Thread.Sleep(1000);
+		test.Close();
+	}
+}
+
+public class form : Form
+{
+	internal 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();
+		}
+}
+
+2. compile with "mcs main.cs /r:System.Windows.Forms"
+3. run
+
+Actual Results:
+
+Nothing shows in the listBox, unless it's event queue gets kicked from
+inside - either by moving mouse over the listBox or by adding a
+System.Windows.Forms.Timer pumping events to the form (for example,
+invalidating a 0x0 rectangle). The pumping has to be done from the forms'
+thread, external threads (ie. other timers) don't work.
+
+
+Expected Results:
+ListBox updates showing the added string.
+
+How often does this happen? 
+
+Everytime.


More information about the mono-bugs mailing list