Fixed problem with unplugging controllers causing cross thread problems

This commit is contained in:
Travis Nickles 2018-08-24 17:35:57 -05:00
parent 0ce20cdfc8
commit 0896f044e8
2 changed files with 7 additions and 3 deletions

View File

@ -1047,8 +1047,11 @@ namespace DS4Windows
lag[ind] = false;
inWarnMonitor[ind] = false;
useDInputOnly[ind] = true;
uiContext?.Post(new SendOrPostCallback((state) =>
{
OnControllerRemoved(this, ind);
Thread.Sleep(XINPUT_UNPLUG_SETTLE_TIME);
}), null);
//Thread.Sleep(XINPUT_UNPLUG_SETTLE_TIME);
}
}
}

View File

@ -2174,14 +2174,15 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question
FormLocationX = Location.X > 0 ? Location.X : 0;
FormLocationY = Location.Y > 0 ? Location.Y : 0;
Global.ControllerRemoved -= ControllerRemovedChange;
if (!string.IsNullOrEmpty(appdatapath))
{
Save();
blankControllerTab();
Program.rootHub.Stop();
}
TaskRunner.Run(() => Program.rootHub.Stop()).Wait();
// Make sure to stop event generation routines. Should fix odd crashes on shutdown
Application.Exit();
}