[Mono-bugs] [Bug 78823][Nor] New - Splash implementation hangs

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Jul 11 17:07:36 EDT 2006


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 roger.jakobsson at jorosoft.se.

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

--- shadow/78823	2006-07-11 17:07:36.000000000 -0400
+++ shadow/78823.tmp.11224	2006-07-11 17:07:36.000000000 -0400
@@ -0,0 +1,139 @@
+Bug#: 78823
+Product: Mono: Class Libraries
+Version: 1.1
+OS: other
+OS Details: Ubuntu
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Windows.Forms
+AssignedTo: peter at novonyx.com                            
+ReportedBy: roger.jakobsson at jorosoft.se               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Summary: Splash implementation hangs
+
+Description of Problem:
+This splash screen implementation hangs mono completely.
+
+Steps to reproduce the problem:
+1. Compile the following code:
+
+using System;
+using System.Threading;
+using System.Windows.Forms;
+
+namespace SplashTest
+{
+	public sealed class AppStart
+	{
+		private static SplashForm splash;
+		private static ThreadStart showSplash;
+		private static Thread myThread;
+		private static ApplicationContext context;
+
+		[STAThread]
+		static void Main() 
+		{			
+			context = new ApplicationContext();		
+			Application.Idle += new EventHandler(AppIdle);
+			
+			showSplash = new ThreadStart(AppStart.ShowSplash);
+			myThread = new Thread(showSplash);		
+		
+			myThread.IsBackground = true;
+			myThread.ApartmentState = ApartmentState.STA;
+			myThread.Start();
+			
+			Application.Run(context);
+		}
+
+		public static void ShowSplash()
+		{
+			splash = new SplashForm();
+			Application.Run(splash);			
+		}
+
+		private static void AppIdle(object sender, EventArgs e)
+		{			
+			if(context.MainForm == null)
+			{
+					context.MainForm = new MainForm();
+					context.MainForm.Show();
+					Application.DoEvents();		
+			
+					CleanUpSplash();
+					Application.Idle -= new 
+EventHandler(AppIdle);
+			}
+		}
+
+		private static void CleanUpSplash()
+		{			
+			if (myThread == null) return;
+			if (splash == null) return;
+
+			try
+			{
+				splash.Invoke(new MethodInvoker
+(splash.Close));
+			}
+			catch (Exception)
+			{
+			}
+			myThread = null;
+			splash = null;					
+		} 
+
+	}
+
+	public class SplashForm : Form
+	{
+		public SplashForm()
+		{
+			this.Show();
+			Application.DoEvents();
+			this.BackColor = System.Drawing.Color.White;
+			Label lb = new Label();
+			lb.Text = "This is the splash";
+			this.Controls.Add(lb);
+		}
+	}
+
+	public class MainForm : Form
+	{
+		public MainForm()
+		{
+			this.Show();
+			Application.DoEvents();
+			// Just for test, normally here is code that take 
+some time
+			Thread.Sleep(2000);
+			Label lb = new Label();
+			lb.Text = "This is the main form";
+			this.Controls.Add(lb);
+		}
+	}
+}
+
+2. 
+3. 
+
+Actual Results:
+The splash shows but then everything hangs
+
+Expected Results:
+Splash displayed for 2 seconds, then disappear and only the main form 
+visible.
+
+How often does this happen? 
+Always
+
+Additional Information:
+Tested in Ubuntu 6.06 and Mono from SVN as of today
+
+Case 2:
+Remove Application.DoEvents() and it somewhat works, but not really, 
+hangs in another way..


More information about the mono-bugs mailing list