Fixed hanging when disconnecting a USB controller

Related to issue #3.
This commit is contained in:
Travis Nickles 2017-03-25 08:49:03 -07:00
parent a5f51f78e9
commit 112b550473
2 changed files with 12 additions and 2 deletions

View File

@ -129,7 +129,6 @@
this.cBFlashWhenLate = new System.Windows.Forms.CheckBox();
this.cBCloseMini = new System.Windows.Forms.CheckBox();
this.cBQuickCharge = new System.Windows.Forms.CheckBox();
this.cBUseWhiteIcon = new System.Windows.Forms.CheckBox();
this.cBDownloadLangauge = new System.Windows.Forms.CheckBox();
this.cBUpdate = new System.Windows.Forms.CheckBox();
this.pNUpdate = new System.Windows.Forms.Panel();
@ -138,6 +137,7 @@
this.nUDUpdateTime = new System.Windows.Forms.NumericUpDown();
this.pnlXIPorts = new System.Windows.Forms.Panel();
this.lbUseXIPorts = new System.Windows.Forms.Label();
this.cBUseWhiteIcon = new System.Windows.Forms.CheckBox();
this.nUDXIPorts = new System.Windows.Forms.NumericUpDown();
this.lbLastXIPort = new System.Windows.Forms.Label();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
@ -152,6 +152,7 @@
this.cMCustomLed = new System.Windows.Forms.ContextMenuStrip(this.components);
this.useProfileColorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.useCustomColorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.advColorDialog = new AdvancedColorDialog();
this.pnlButton.SuspendLayout();
this.cMTaskbar.SuspendLayout();
this.tabMain.SuspendLayout();

View File

@ -135,7 +135,16 @@ namespace DS4Windows
private void closeFileStreamIO()
{
if (fileStream != null)
fileStream.Close();
{
try
{
fileStream.Close();
}
catch (IOException)
{
}
}
fileStream = null;
Console.WriteLine("Close fs");
if (safeReadHandle != null && !safeReadHandle.IsInvalid)