Permalink
Browse files

fixed startup deadlock

  • Loading branch information...
1 parent 60ec2a7 commit 9b8daa2e71e3c246a0f67de0c5c70f4595ac2b2e @seuffert committed Mar 8, 2011
Showing with 14 additions and 14 deletions.
  1. +3 −12 XBSlink/Form1.cs
  2. +11 −2 XBSlink/Program.cs
View
15 XBSlink/Form1.cs
@@ -87,8 +87,6 @@ partial class FormMain : Form
private DateTime last_nodelist_update = new DateTime(0);
- private bool exit_app = false;
-
public FormMain()
{
#if DEBUG
@@ -101,6 +99,9 @@ public FormMain()
this.MaximumSize = new System.Drawing.Size(450, this.MaximumSize.Height);
this.MinimumSize = new System.Drawing.Size(this.MaximumSize.Width, this.MinimumSize.Height);
}
+
+ if (!initializeCaptureDeviceList())
+ throw new ApplicationException("no capture devices found");
}
private void initializeCloudListView()
@@ -117,12 +118,6 @@ private void Form1_Load(object sender, EventArgs e)
// globally turn off Proxy auto detection
WebRequest.DefaultWebProxy = null;
- if (!initializeCaptureDeviceList())
- {
- exit_app = true;
- return;
- }
-
node_list = new xbs_node_list();
updatecheck_webclient = new WebClient();
natstun = new xbs_natstun();
@@ -1207,10 +1202,6 @@ private void tabControl1_TabIndexChanged(object sender, EventArgs e)
private void FormMain_VisibleChanged(object sender, EventArgs e)
{
- if (exit_app)
- {
- this.Close();
- }
}
}
}
View
13 XBSlink/Program.cs
@@ -39,8 +39,17 @@ static void Main()
Application.SetCompatibleTextRenderingDefault(false);
settings = new xbs_settings();
- main_form = new FormMain();
- Application.Run(main_form);
+ try
+ {
+ main_form = new FormMain();
+ }
+ catch (ApplicationException)
+ {
+ main_form = null;
+ }
+
+ if (main_form != null )
+ Application.Run(main_form);
}
}
}

0 comments on commit 9b8daa2

Please sign in to comment.