OSDN Git Service

Change ordering of memory allocation and calling Thread::run().
authorAravind Akella <aakella@google.com>
Tue, 7 Oct 2014 21:13:12 +0000 (14:13 -0700)
committerAravind Akella <aakella@google.com>
Tue, 7 Oct 2014 21:20:12 +0000 (21:20 +0000)
In some cases this is causing a crash as device.poll is called with
NULL.

Bug: 17896339
Change-Id: Id431599f2c661338c355c7081b6602f8449a9198

services/sensorservice/SensorService.cpp

index 8831893..0f945f7 100644 (file)
@@ -185,14 +185,14 @@ void SensorService::onFirstRef()
             }
 
             mWakeLockAcquired = false;
-            run("SensorService", PRIORITY_URGENT_DISPLAY);
             mLooper = new Looper(false);
-
             const size_t minBufferSize = SensorEventQueue::MAX_RECEIVE_BUFFER_EVENT_COUNT;
             mSensorEventBuffer = new sensors_event_t[minBufferSize];
             mSensorEventScratch = new sensors_event_t[minBufferSize];
             mMapFlushEventsToConnections = new SensorEventConnection const * [minBufferSize];
+
             mInitCheck = NO_ERROR;
+            run("SensorService", PRIORITY_URGENT_DISPLAY);
         }
     }
 }