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

Commit 1b3e9295 authored by Andy Hung's avatar Andy Hung Committed by Android (Google) Code Review
Browse files

Merge "SpatializerPoseController: Fix destruction order" into udc-dev

parents eafc269c 656e0275
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -121,9 +121,7 @@ class SpatializerPoseController : private media::SensorPoseProvider::Listener {
    mutable std::timed_mutex mMutex;
    Listener* const mListener;
    const std::chrono::microseconds mSensorPeriod;
    // Order matters for the following two members to ensure correct destruction.
    std::unique_ptr<media::HeadTrackingProcessor> mProcessor;
    std::unique_ptr<media::SensorPoseProvider> mPoseProvider;
    int32_t mHeadSensor = media::SensorPoseProvider::INVALID_HANDLE;
    int32_t mScreenSensor = media::SensorPoseProvider::INVALID_HANDLE;
    std::optional<media::HeadTrackingMode> mActualMode;
@@ -146,6 +144,9 @@ class SpatializerPoseController : private media::SensorPoseProvider::Listener {
        4 /* vectorSize */, std::chrono::minutes(1), 10 /* maxLogLine */,
        { 3 } /* delimiterIdx */};

    // Next to last variable as releasing this stops the callbacks
    std::unique_ptr<media::SensorPoseProvider> mPoseProvider;

    // It's important that mThread is the last variable in this class
    // since we starts mThread in initializer list
    std::thread mThread;