Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4509b940 authored by Ian Rogers's avatar Ian Rogers
Browse files

Fix 2 instances of buggy double check locking on non-volatile fields.

Bug caught by Error Prone:
http://errorprone.info/bugpattern/DoubleCheckedLocking

Bug: 27723540
Change-Id: I0b0c06ce4ae1ffb668e8ab3a7fe07706df173f18
parent 9f3545f2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -378,7 +378,7 @@ public class EventBus extends BroadcastReceiver {

    // Used for initializing the default bus
    private static final Object sLock = new Object();
    private static EventBus sDefaultBus;
    private static volatile EventBus sDefaultBus;

    // The handler to post all events
    private Handler mHandler;
+1 −1
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ class NetworkStatsObservers {
    private final AtomicInteger mNextDataUsageRequestId = new AtomicInteger();

    // Lazily instantiated when an observer is registered.
    private Handler mHandler;
    private volatile Handler mHandler;

    /**
     * Creates a wrapper that contains the caller context and a normalized request.