mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-02 10:24:11 +01:00
AndroidGCS: Add back a few synchronize blocks in telemetry to avoid removing
elements twice.
This commit is contained in:
parent
cf4dbe2b07
commit
e43651e57e
@ -551,11 +551,13 @@ public class Telemetry {
|
|||||||
|
|
||||||
// Get object information from queue (first the priority and then the regular queue)
|
// Get object information from queue (first the priority and then the regular queue)
|
||||||
ObjectQueueInfo objInfo;
|
ObjectQueueInfo objInfo;
|
||||||
|
synchronized (objPriorityQueue) {
|
||||||
if ( !objPriorityQueue.isEmpty() )
|
if ( !objPriorityQueue.isEmpty() )
|
||||||
{
|
{
|
||||||
objInfo = objPriorityQueue.remove();
|
objInfo = objPriorityQueue.remove();
|
||||||
}
|
} else {
|
||||||
else if ( !objQueue.isEmpty() )
|
synchronized (objQueue) {
|
||||||
|
if ( !objQueue.isEmpty() )
|
||||||
{
|
{
|
||||||
objInfo = objQueue.remove();
|
objInfo = objQueue.remove();
|
||||||
}
|
}
|
||||||
@ -563,6 +565,9 @@ public class Telemetry {
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check if a connection has been established, only process GCSTelemetryStats updates
|
// Check if a connection has been established, only process GCSTelemetryStats updates
|
||||||
// (used to establish the connection)
|
// (used to establish the connection)
|
||||||
|
Loading…
Reference in New Issue
Block a user