mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-20 11:33:06 +00:00
Fix a race that could crash a few threads in the input thread pool
This commit is contained in:
parent
48f8a05bae
commit
a1440621f9
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user