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

Commit 45dfb6ae authored by Haynes Mathew George's avatar Haynes Mathew George Committed by Iliyan Malchev
Browse files

Synchronize access to OMX class member variables

- Protect access to mLiveNodes KeyedVector member variable in freeNode function

Change-Id: Ic86844aabc2bc897ffb7fc91cd1f54254f5e29fe
parent 1f1493ce
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -252,6 +252,8 @@ status_t OMX::allocateNode(
status_t OMX::freeNode(node_id node) {
    OMXNodeInstance *instance = findInstance(node);

    {
        Mutex::Autolock autoLock(mLock);
        ssize_t index = mLiveNodes.indexOfKey(instance->observer()->asBinder());
        if (index < 0) {
            // This could conceivably happen if the observer dies at roughly the
@@ -259,6 +261,7 @@ status_t OMX::freeNode(node_id node) {
            return OK;
        }
        mLiveNodes.removeItemsAt(index);
    }

    instance->observer()->asBinder()->unlinkToDeath(this);

@@ -266,7 +269,7 @@ status_t OMX::freeNode(node_id node) {

    {
        Mutex::Autolock autoLock(mLock);
        index = mDispatchers.indexOfKey(node);
        ssize_t index = mDispatchers.indexOfKey(node);
        CHECK(index >= 0);
        mDispatchers.removeItemsAt(index);
    }