mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-04-02 22:16:13 +00:00
Fix a race that could crash a few threads in the input thread pool
This commit is contained in:
@@ -194,8 +194,13 @@ public class NvConnection {
|
||||
|
||||
private boolean startInputConnection() throws IOException
|
||||
{
|
||||
inputStream = new NvController(hostAddr);
|
||||
inputStream.initialize();
|
||||
// Because input events can be delivered at any time, we must only assign
|
||||
// it to the instance variable once the object is properly initialized.
|
||||
// This avoids the race where inputStream != null but inputStream.initialize()
|
||||
// has not returned yet.
|
||||
NvController tempController = new NvController(hostAddr);
|
||||
tempController.initialize();
|
||||
inputStream = tempController;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user