mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-20 03:23:07 +00:00
Fix race condition in USB driver initialization and cleanup
This commit is contained in:
parent
e8f04f5a3b
commit
1c3b9a3859
@ -114,13 +114,13 @@ public abstract class AbstractXboxController extends AbstractController {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Report that we're added _before_ starting the input thread
|
||||||
|
notifyDeviceAdded();
|
||||||
|
|
||||||
// Start listening for controller input
|
// Start listening for controller input
|
||||||
inputThread = createInputThread();
|
inputThread = createInputThread();
|
||||||
inputThread.start();
|
inputThread.start();
|
||||||
|
|
||||||
// Now report we're added
|
|
||||||
notifyDeviceAdded();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,11 +137,11 @@ public abstract class AbstractXboxController extends AbstractController {
|
|||||||
inputThread = null;
|
inputThread = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Report the device removed
|
|
||||||
notifyDeviceRemoved();
|
|
||||||
|
|
||||||
// Close the USB connection
|
// Close the USB connection
|
||||||
connection.close();
|
connection.close();
|
||||||
|
|
||||||
|
// Report the device removed
|
||||||
|
notifyDeviceRemoved();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract boolean handleRead(ByteBuffer buffer);
|
protected abstract boolean handleRead(ByteBuffer buffer);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user