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

Commit 44d99379 authored by Dan Egnor's avatar Dan Egnor Committed by Android (Google) Code Review
Browse files

Merge "Fix NPE in FileObserver when multiple events pile in for a defunct...

Merge "Fix NPE in FileObserver when multiple events pile in for a defunct observer.  Also, fix up some bogus whitespace (hard tabs, etc)."
parents 1655e285 d95244fa
Loading
Loading
Loading
Loading
+66 −64
Original line number Diff line number Diff line
@@ -88,15 +88,17 @@ public abstract class FileObserver {

        public void onEvent(int wfd, int mask, String path) {
            // look up our observer, fixing up the map if necessary...
        FileObserver observer;
            FileObserver observer = null;

            synchronized (m_observers) {
                WeakReference weak = m_observers.get(wfd);
                if (weak != null) {  // can happen with lots of events from a dead wfd
                    observer = (FileObserver) weak.get();
                    if (observer == null) {
                        m_observers.remove(wfd);
                    }
                }
            }

            // ...then call out to the observer without the sync lock held
            if (observer != null) {