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

Commit ee0ba599 authored by Eric Laurent's avatar Eric Laurent Committed by Automerger Merge Worker
Browse files

Merge "Increase lock scope to protect variables" into main am: 8b949276

parents 38bb84e7 8b949276
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -366,14 +366,15 @@ status_t AudioEffect::command(uint32_t cmdCode,
        return mStatus;
    }

    std::unique_lock ul(mLock, std::defer_lock);
    if (cmdCode == EFFECT_CMD_ENABLE || cmdCode == EFFECT_CMD_DISABLE) {
        ul.lock();
        if (mEnabled == (cmdCode == EFFECT_CMD_ENABLE)) {
            return NO_ERROR;
        }
        if (replySize == nullptr || *replySize != sizeof(status_t) || replyData == nullptr) {
            return BAD_VALUE;
        }
        mLock.lock();
    }

    std::vector<uint8_t> data;
@@ -398,7 +399,6 @@ status_t AudioEffect::command(uint32_t cmdCode,
        if (status == NO_ERROR) {
            mEnabled = (cmdCode == EFFECT_CMD_ENABLE);
        }
        mLock.unlock();
    }

    return status;