mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-29 20:44:20 +01:00
Change methods to check for null thread objects
It looks like there are cases when the stop update methods could be called before the thread objecs are created
This commit is contained in:
parent
8df30a5bbb
commit
ade55d3b9f
@ -397,7 +397,8 @@ namespace DS4Windows
|
|||||||
|
|
||||||
public void StopUpdate()
|
public void StopUpdate()
|
||||||
{
|
{
|
||||||
if (ds4Input.IsAlive && !ds4Input.ThreadState.HasFlag(System.Threading.ThreadState.Stopped) &&
|
if (ds4Input != null &&
|
||||||
|
ds4Input.IsAlive && !ds4Input.ThreadState.HasFlag(System.Threading.ThreadState.Stopped) &&
|
||||||
!ds4Input.ThreadState.HasFlag(System.Threading.ThreadState.AbortRequested))
|
!ds4Input.ThreadState.HasFlag(System.Threading.ThreadState.AbortRequested))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -418,7 +419,8 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
lock (exitLocker)
|
lock (exitLocker)
|
||||||
{
|
{
|
||||||
if (ds4Output.IsAlive && !ds4Output.ThreadState.HasFlag(System.Threading.ThreadState.Stopped) &&
|
if (ds4Output != null &&
|
||||||
|
ds4Output.IsAlive && !ds4Output.ThreadState.HasFlag(System.Threading.ThreadState.Stopped) &&
|
||||||
!ds4Output.ThreadState.HasFlag(System.Threading.ThreadState.AbortRequested))
|
!ds4Output.ThreadState.HasFlag(System.Threading.ThreadState.AbortRequested))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -81,6 +81,7 @@ namespace DS4Windows
|
|||||||
if (isExclusiveMode && !hDevice.IsOpen)
|
if (isExclusiveMode && !hDevice.IsOpen)
|
||||||
hDevice.OpenDevice(false);
|
hDevice.OpenDevice(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDevice.IsOpen)
|
if (hDevice.IsOpen)
|
||||||
{
|
{
|
||||||
string serial = hDevice.readSerial();
|
string serial = hDevice.readSerial();
|
||||||
|
Loading…
Reference in New Issue
Block a user