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

Commit 85fb869b authored by Dongwon Kang's avatar Dongwon Kang Committed by android-build-merger
Browse files

Merge "Protect sp assignments in RemoteDataSource." into oc-dev am: 318e41b4

am: cafbb078

Change-Id: I5490e154eb0bd253ac6b6ed7df403b9a506e4163
parents 5d3d94e2 cafbb078
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;