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

Commit 318e41b4 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Protect sp assignments in RemoteDataSource." into oc-dev

parents d1e15b12 009ff0dd
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -54,6 +54,9 @@ public:
        return mSource->getSize(size);
    }
    virtual void close() {
        // Protect strong pointer assignments. This also can be called from the binder
        // clean-up procedure which is running on a separate thread.
        Mutex::Autolock lock(mCloseLock);
        mSource = nullptr;
        mMemory = nullptr;
    }
@@ -75,6 +78,7 @@ private:
    sp<IMemory> mMemory;
    sp<DataSource> mSource;
    String8 mName;
    Mutex mCloseLock;

    explicit RemoteDataSource(const sp<DataSource> &source) {
        mSource = source;